Chromium Code Reviews| 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 src="../tracing-test.js"></script> | |
| 6 <script> | |
| 7 function performActions(callback) | |
| 8 { | |
| 9 var square = document.getElementById("square"); | |
| 10 step1(); | |
| 11 | |
| 12 function step1() | |
| 13 { | |
| 14 square.style.backgroundColor = "red"; | |
| 15 testRunner.layoutAndPaintAsyncThen(step2); | |
| 16 } | |
| 17 | |
| 18 function step2() | |
| 19 { | |
| 20 square.style.backgroundColor = "black"; | |
| 21 testRunner.layoutAndPaintAsyncThen(callback); | |
| 22 } | |
| 23 } | |
| 24 | |
| 25 function test() | |
| 26 { | |
| 27 var panel = WebInspector.panels.timeline; | |
| 28 | |
| 29 panel._captureLayersAndPicturesSetting.set(true); | |
| 30 panel._flameChartEnabledSetting.set(true); | |
| 31 panel._onModeChanged(); | |
| 32 | |
| 33 InspectorTest.invokeAsyncWithTimeline("performActions", onRecordingDone); | |
| 34 var paintEvents = []; | |
| 35 function onRecordingDone() | |
| 36 { | |
| 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 " + paintE vents.length); | |
| 43 } | |
| 44 } | |
| 45 | |
| 46 if (paintEvents.length < 2) | |
| 47 throw new Error("FAIL: Expect at least two paint events"); | |
| 48 | |
| 49 InspectorTest.addSniffer(panel, "_appendDetailsTabsForTraceEventAndShowD etails", onRecordDetailsReady, false); | |
|
pfeldman
2015/06/01 16:13:29
Is there a way to avoid 2 sniffers in this test? I
| |
| 50 panel.select(WebInspector.TimelineSelection.fromTraceEvent(paintEvents[0 ]), WebInspector.TimelinePanel.DetailsTab.PaintProfiler); | |
| 51 } | |
| 52 | |
| 53 function onRecordDetailsReady() | |
| 54 { | |
| 55 var updateCount = 0; | |
| 56 var paintProfilerView = panel._lazyPaintProfilerView._paintProfilerView; | |
| 57 InspectorTest.addSniffer(paintProfilerView, "_update", onPaintProfilerUp date, true); | |
| 58 | |
| 59 function onPaintProfilerUpdate() | |
| 60 { | |
| 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.lengt h ? ">0" : "0"; | |
| 65 InspectorTest.addResult("Paint " + updateCount + " log size: " + log Size); | |
| 66 if (updateCount++) | |
| 67 InspectorTest.completeTest(); | |
| 68 else | |
| 69 panel.select(WebInspector.TimelineSelection.fromTraceEvent(paint Events[1]), WebInspector.TimelinePanel.DetailsTab.PaintProfiler); | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 } | |
| 74 | |
| 75 </script> | |
| 76 </head> | |
| 77 | |
| 78 <body onload="runTest()"> | |
| 79 <p> | |
| 80 Tests that paint profiler is properly update when an event is selected in Flame Chart | |
| 81 </p> | |
| 82 | |
| 83 <div id="square" style="width: 40px; height: 40px"></div> | |
| 84 | |
| 85 </body> | |
| 86 </html> | |
| OLD | NEW |