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
.getElementById("testElement").style
.width
= "100px";
11 var forceLayout1
= document
.body
.offsetTop
;
12 document
.getElementById("testElement").style
.width
= "110px";
13 var forceLayout2
= document
.body
.offsetTop
;
14 if (window
.testRunner
)
15 testRunner
.layoutAndPaintAsyncThen(callback
);
19 function updateSubframeAndDisplay(callback
)
21 requestAnimationFrame(function() {
22 frames
[0].document
.body
.children
[0].style
.width
= "10px";
23 var forceLayout1
= frames
[0].document
.body
.offsetTop
;
24 frames
[0].document
.body
.children
[0].style
.width
= "20px";
25 var forceLayout2
= frames
[0].document
.body
.offsetTop
;
26 if (window
.testRunner
)
27 testRunner
.layoutAndPaintAsyncThen(callback
);
33 var currentPanel
= WebInspector
.inspectorView
.currentPanel();
34 InspectorTest
.assertEquals(currentPanel
._panelName
, "timeline", "Current panel should be the timeline.");
35 Runtime
.experiments
.enableForTest("timelineInvalidationTracking");
37 InspectorTest
.runTestSuite([
38 function testLocalFrame(next
)
40 InspectorTest
.invokeAsyncWithTimeline("display", function() {
41 var firstLayoutRecord
= InspectorTest
.findFirstTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Layout
);
42 InspectorTest
.addArray(firstLayoutRecord
._event
.invalidationTrackingEvents
, InspectorTest
.InvalidationFormatters
, "", "first layout invalidations");
44 var secondLayoutRecord
= InspectorTest
.findTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Layout
, 1);
45 InspectorTest
.addArray(secondLayoutRecord
._event
.invalidationTrackingEvents
, InspectorTest
.InvalidationFormatters
, "", "second layout invalidations");
51 function testSubframe(next
)
53 InspectorTest
.invokeAsyncWithTimeline("updateSubframeAndDisplay", function() {
54 var firstLayoutRecord
= InspectorTest
.findFirstTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Layout
);
55 InspectorTest
.addArray(firstLayoutRecord
._event
.invalidationTrackingEvents
, InspectorTest
.InvalidationFormatters
, "", "first layout invalidations");
57 var secondLayoutRecord
= InspectorTest
.findTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Layout
, 1);
58 InspectorTest
.addArray(secondLayoutRecord
._event
.invalidationTrackingEvents
, InspectorTest
.InvalidationFormatters
, "", "second layout invalidations");
67 <body onload=
"runTest()">
68 <p>Tests the Timeline API instrumentation of layout events with invalidations.
</p>
69 <div id=
"outerTestElement" style=
"display: inline-block;"><div id=
"testElement">PASS
</div></div>
70 <iframe src=
"resources/timeline-iframe-paint.html" style=
"position: absolute; left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>