3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../http/tests/inspector/timeline-test.js"></script>
7 function display(callback
)
9 requestAnimationFrame(function() {
10 document
.body
.style
.backgroundColor
= "blue";
11 if (window
.testRunner
)
12 testRunner
.layoutAndPaintAsyncThen(callback
);
16 function updateSubframeAndDisplay(callback
)
18 requestAnimationFrame(function() {
19 frames
[0].document
.body
.children
[0].style
.backgroundColor
= "green";
20 if (window
.testRunner
)
21 testRunner
.layoutAndPaintAsyncThen(callback
);
27 InspectorTest
.invokeAsyncWithTimeline("display", step1
);
29 function step1(records
)
31 var record
= InspectorTest
.findFirstTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Paint
);
33 InspectorTest
.printTimelineRecordProperties(record
);
35 InspectorTest
.addResult("FAIL: no paint record found");
36 InspectorTest
.invokeAsyncWithTimeline("updateSubframeAndDisplay", step3
);
39 function step3(records
)
41 var paintRecord
= InspectorTest
.findFirstTimelineRecord(WebInspector
.TimelineModel
.RecordType
.Paint
);
42 InspectorTest
.assertTrue(paintRecord
, "Paint record with subframe paint not found");
43 var topQuad
= paintRecord
.traceEvent().args
["data"].clip
;
44 var subframePaint
= paintRecord
.children()[0];
45 var subframeQuad
= subframePaint
.traceEvent().args
["data"].clip
;
46 InspectorTest
.assertEquals(8, topQuad
.length
);
47 InspectorTest
.assertEquals(8, subframeQuad
.length
);
48 InspectorTest
.assertGreaterOrEqual(subframeQuad
[0], topQuad
[0]);
49 InspectorTest
.assertGreaterOrEqual(subframeQuad
[1], topQuad
[1]);
50 InspectorTest
.assertGreaterOrEqual(topQuad
[2], subframeQuad
[2]);
51 InspectorTest
.assertGreaterOrEqual(subframeQuad
[3], topQuad
[3]);
52 InspectorTest
.assertGreaterOrEqual(topQuad
[4], subframeQuad
[4]);
53 InspectorTest
.assertGreaterOrEqual(topQuad
[5], subframeQuad
[5]);
54 InspectorTest
.assertGreaterOrEqual(subframeQuad
[6], topQuad
[6]);
55 InspectorTest
.assertGreaterOrEqual(topQuad
[7], subframeQuad
[7]);
57 InspectorTest
.completeTest();
64 <body onload=
"runTest()">
66 Tests the Timeline API instrumentation of a paint event
68 <iframe src=
"resources/timeline-iframe-paint.html" style=
"position: absolute; left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>