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> | |
6 | |
7 function display(callback) | |
8 { | |
9 requestAnimationFrame(function() { | |
10 document.body.style.backgroundColor = "blue"; | |
11 if (window.testRunner) | |
12 testRunner.layoutAndPaintAsyncThen(callback); | |
13 }); | |
14 } | |
15 | |
16 function updateSubframeAndDisplay(callback) | |
17 { | |
18 requestAnimationFrame(function() { | |
19 frames[0].document.body.children[0].style.backgroundColor = "green"; | |
20 if (window.testRunner) | |
21 testRunner.layoutAndPaintAsyncThen(callback); | |
22 }); | |
23 } | |
24 | |
25 function test() | |
26 { | |
27 InspectorTest.invokeAsyncWithTimeline("display", step1); | |
28 | |
29 function step1(records) | |
30 { | |
31 var record = InspectorTest.findFirstTimelineRecord(WebInspector.Timeline
Model.RecordType.Paint); | |
32 if (record) | |
33 InspectorTest.printTimelineRecordProperties(record); | |
34 else | |
35 InspectorTest.addResult("FAIL: no paint record found"); | |
36 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", step3)
; | |
37 } | |
38 | |
39 function step3(records) | |
40 { | |
41 var paintRecord = InspectorTest.findFirstTimelineRecord(WebInspector.Tim
elineModel.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]); | |
56 | |
57 InspectorTest.completeTest(); | |
58 } | |
59 } | |
60 | |
61 </script> | |
62 </head> | |
63 | |
64 <body onload="runTest()"> | |
65 <p> | |
66 Tests the Timeline API instrumentation of a paint event | |
67 </p> | |
68 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | |
69 </body> | |
70 </html> | |
OLD | NEW |