Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / tracing / paint-profiler-update.html
blob1dfcf2d348102f8e557b93ead0c6806814408f7b
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 src="../tracing-test.js"></script>
6 <script>
7 function performActions(callback)
9 var square = document.getElementById("square");
10 step1();
12 function step1()
14 square.style.backgroundColor = "red";
15 testRunner.layoutAndPaintAsyncThen(step2);
18 function step2()
20 square.style.backgroundColor = "black";
21 testRunner.layoutAndPaintAsyncThen(callback);
25 function test()
27 var panel = WebInspector.panels.timeline;
29 panel._captureLayersAndPicturesSetting.set(true);
30 panel._flameChartEnabledSetting.set(true);
31 panel._onModeChanged();
33 InspectorTest.invokeAsyncWithTimeline("performActions", onRecordingDone);
34 var paintEvents = [];
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);
41 if (!event.picture)
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()
55 var updateCount = 0;
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)
63 return;
64 var logSize = paintProfilerView._log && paintProfilerView._log.length ? ">0" : "0";
65 InspectorTest.addResult("Paint " + updateCount + " log size: " + logSize);
66 if (updateCount++)
67 InspectorTest.completeTest();
68 else
69 panel.select(WebInspector.TimelineSelection.fromTraceEvent(paintEvents[1]), WebInspector.TimelinePanel.DetailsTab.PaintProfiler);
75 </script>
76 </head>
78 <body onload="runTest()">
79 <p>
80 Tests that paint profiler is properly update when an event is selected in Flame Chart
81 </p>
83 <div id="square" style="width: 40px; height: 40px"></div>
85 </body>
86 </html>