4 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
5 <script src=
"../../http/tests/inspector/timeline-test.js"></script>
7 function display(callback
)
9 requestAnimationFrame(function() {
10 document
.body
.style
.backgroundColor
= "blue";
11 document
.getElementById("testElement").style
.width
= "100px";
12 var forceLayout
= document
.body
.offsetTop
;
13 if (window
.testRunner
)
14 testRunner
.layoutAndPaintAsyncThen(callback
);
18 function updateSubframeAndDisplay(callback
)
20 requestAnimationFrame(function() {
21 frames
[0].document
.body
.children
[0].style
.width
= "200px";
22 var forceLayout
= frames
[0].document
.body
.offsetTop
;
23 if (window
.testRunner
)
24 testRunner
.layoutAndPaintAsyncThen(callback
);
30 var currentPanel
= WebInspector
.inspectorView
.currentPanel();
31 InspectorTest
.assertEquals(currentPanel
._panelName
, "timeline", "Current panel should be the timeline.");
32 Runtime
.experiments
.enableForTest("timelineInvalidationTracking");
34 InspectorTest
.runTestSuite([
35 function testLocalFrame(next
)
37 InspectorTest
.invokeAsyncWithTimeline("display", function() {
38 var record
= InspectorTest
.findFirstTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Paint
);
39 InspectorTest
.addArray(record
._event
.invalidationTrackingEvents
, InspectorTest
.InvalidationFormatters
, "", "paint invalidations");
45 function testSubframe(next
)
47 InspectorTest
.invokeAsyncWithTimeline("updateSubframeAndDisplay", function() {
48 // The first paint corresponds to the local frame and should have no invalidations.
49 var firstPaintRecord
= InspectorTest
.findFirstTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Paint
);
50 var firstInvalidations
= firstPaintRecord
._event
.invalidationTrackingEvents
;
51 InspectorTest
.assertEquals(firstInvalidations
, undefined);
53 // The second paint corresponds to the subframe and should have our layout/style invalidations.
54 var secondPaintRecord
= InspectorTest
.findTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Paint
, 1);
55 InspectorTest
.addArray(secondPaintRecord
._event
.invalidationTrackingEvents
, InspectorTest
.InvalidationFormatters
, "", "second paint invalidations");
64 <body onload=
"runTest()">
65 <p>Tests the Timeline API instrumentation of paint events with layout invalidations.
</p>
66 <div id=
"testElement">PASS
</div>
67 <iframe src=
"resources/timeline-iframe-paint.html" style=
"position: absolute; left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>