3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../http/tests/inspector/timeline-test.js"></script>
5 <script src=
"../tracing-test.js"></script>
7 function performActions(callback
)
9 var square
= document
.getElementById("square");
14 square
.style
.backgroundColor
= "red";
15 testRunner
.layoutAndPaintAsyncThen(step2
);
20 square
.style
.backgroundColor
= "black";
21 testRunner
.layoutAndPaintAsyncThen(callback
);
27 var panel
= WebInspector
.panels
.timeline
;
29 panel
._captureLayersAndPicturesSetting
.set(true);
30 panel
._flameChartEnabledSetting
.set(true);
31 panel
._onModeChanged();
33 InspectorTest
.invokeAsyncWithTimeline("performActions", onRecordingDone
);
35 function onRecordingDone()
37 var events
= InspectorTest
.tracingTimelineModel()._mainThreadEvents
;
38 for (var event
of events
) {
39 if (event
.name
=== WebInspector
.TimelineModel
.RecordType
.Paint
) {
40 paintEvents
.push(event
);
42 InspectorTest
.addResult("Event without picture at " + paintEvents
.length
);
46 if (paintEvents
.length
< 2)
47 throw new Error("FAIL: Expect at least two paint events");
49 InspectorTest
.addSniffer(panel
, "_appendDetailsTabsForTraceEventAndShowDetails", onRecordDetailsReady
, false);
50 panel
.select(WebInspector
.TimelineSelection
.fromTraceEvent(paintEvents
[0]), WebInspector
.TimelinePanel
.DetailsTab
.PaintProfiler
);
53 function onRecordDetailsReady()
56 var paintProfilerView
= panel
._lazyPaintProfilerView
._paintProfilerView
;
57 InspectorTest
.addSniffer(paintProfilerView
, "_update", onPaintProfilerUpdate
, true);
59 function onPaintProfilerUpdate()
61 // No snapshot, not a real update yet -- wait for another update!
62 if (!paintProfilerView
._snapshot
)
64 var logSize
= paintProfilerView
._log
&& paintProfilerView
._log
.length
? ">0" : "0";
65 InspectorTest
.addResult("Paint " + updateCount
+ " log size: " + logSize
);
67 InspectorTest
.completeTest();
69 panel
.select(WebInspector
.TimelineSelection
.fromTraceEvent(paintEvents
[1]), WebInspector
.TimelinePanel
.DetailsTab
.PaintProfiler
);
78 <body onload=
"runTest()">
80 Tests that paint profiler is properly update when an event is selected in Flame Chart
83 <div id=
"square" style=
"width: 40px; height: 40px"></div>