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 var element
= document
.getElementById("testElement");
12 element
.style
.width
= "100px";
13 var forceLayout
= document
.body
.offsetTop
;
14 element
.parentElement
.removeChild(element
);
15 if (window
.testRunner
)
16 testRunner
.layoutAndPaintAsyncThen(callback
);
20 function updateSubframeAndDisplay(callback
)
22 requestAnimationFrame(function() {
23 var element
= frames
[0].document
.body
.children
[0];
24 element
.style
.width
= "200px";
25 var forceLayout
= frames
[0].document
.body
.offsetTop
;
26 element
.parentElement
.removeChild(element
);
27 if (window
.testRunner
)
28 testRunner
.layoutAndPaintAsyncThen(callback
);
34 var currentPanel
= WebInspector
.inspectorView
.currentPanel();
35 InspectorTest
.assertEquals(currentPanel
._panelName
, "timeline", "Current panel should be the timeline.");
36 Runtime
.experiments
.enableForTest("timelineInvalidationTracking");
38 InspectorTest
.runTestSuite([
39 function testLocalFrame(next
)
41 InspectorTest
.invokeAsyncWithTimeline("display", function() {
42 var record
= InspectorTest
.findFirstTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Paint
);
43 InspectorTest
.addArray(record
._event
.invalidationTrackingEvents
, InspectorTest
.InvalidationFormatters
, "", "paint invalidations");
49 function testSubframe(next
)
51 InspectorTest
.invokeAsyncWithTimeline("updateSubframeAndDisplay", function() {
52 // The first paint corresponds to the local frame and should have no invalidations.
53 var firstPaintRecord
= InspectorTest
.findFirstTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Paint
);
54 var firstInvalidations
= firstPaintRecord
._event
.invalidationTrackingEvents
;
55 InspectorTest
.assertEquals(firstInvalidations
, undefined);
57 // The second paint corresponds to the subframe and should have our layout/style invalidations.
58 var secondPaintRecord
= InspectorTest
.findTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Paint
, 1);
59 InspectorTest
.addArray(secondPaintRecord
._event
.invalidationTrackingEvents
, InspectorTest
.InvalidationFormatters
, "", "second paint invalidations");
68 <body onload=
"runTest()">
69 <p>Tests the Timeline API instrumentation of layout invalidations on a deleted node.
</p>
70 <div id=
"testElement">FAIL - this should not be present when the test finishes.
</div>
71 <iframe src=
"resources/timeline-iframe-paint.html" style=
"position: absolute; left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>