OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../http/tests/inspector/timeline-test.js"></script> | 4 <script src="../../http/tests/inspector/timeline-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function display(callback) | 7 function display(callback) |
8 { | 8 { |
9 requestAnimationFrame(function() { | 9 requestAnimationFrame(function() { |
10 document.body.style.backgroundColor = "blue"; | 10 document.body.style.backgroundColor = "blue"; |
11 if (window.testRunner) | 11 if (window.testRunner) |
12 testRunner.displayAsyncThen(callback); | 12 testRunner.displayAsyncThen(callback); |
13 }); | 13 }); |
14 } | 14 } |
15 | 15 |
16 function updateSubframeAndDisplay(callback) | 16 function updateSubframeAndDisplay(callback) |
17 { | 17 { |
18 requestAnimationFrame(function() { | 18 requestAnimationFrame(function() { |
19 frames[0].document.body.children[0].style.backgroundColor = "green"; | 19 frames[0].document.body.children[0].style.backgroundColor = "green"; |
20 if (window.testRunner) | 20 if (window.testRunner) |
21 testRunner.displayAsyncThen(callback); | 21 testRunner.displayAsyncThen(callback); |
22 }); | 22 }); |
23 } | 23 } |
24 | 24 |
25 function test() | 25 function test() |
26 { | 26 { |
27 step1(); | 27 InspectorTest.invokeAsyncWithTimeline("display", step1); |
28 | 28 |
29 function step1() | 29 function step1(records) |
30 { | 30 { |
31 InspectorTest.invokeAsyncWithTimeline("display", step2); | 31 var filteredRecords = InspectorTest.filterTimelineRecords(WebInspector.T
imelineModel.RecordType.Paint, true); |
32 } | 32 if (filteredRecords.length) |
33 | 33 InspectorTest.printTimelineRecordProperties(filteredRecords[0]); |
34 function step2(records) | 34 else |
35 { | 35 InspectorTest.addResult("FAIL: no paint record found"); |
36 for (var i = 0; i < records.length; ++i) { | |
37 var record = records[i]; | |
38 if (record.type === WebInspector.TimelineModel.RecordType.Paint) { | |
39 InspectorTest.printTimelineRecordProperties(record); | |
40 break; | |
41 } | |
42 } | |
43 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", step3)
; | 36 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", step3)
; |
44 } | 37 } |
45 | 38 |
46 function step3(records) | 39 function step3(records) |
47 { | 40 { |
| 41 var filteredRecords = InspectorTest.filterTimelineRecords(WebInspector.T
imelineModel.RecordType.Paint, true); |
48 var paintRecord; | 42 var paintRecord; |
49 for (var i = 0; i < records.length; ++i) { | 43 for (var i = 0; i < filteredRecords.length; ++i) { |
50 var record = records[i]; | 44 var record = filteredRecords[i]; |
51 if (record.type === WebInspector.TimelineModel.RecordType.Paint && r
ecord.children && record.children.length) { | 45 if (record.children && record.children.length) { |
52 paintRecord = record; | 46 paintRecord = record; |
53 break; | 47 break; |
54 } | 48 } |
55 } | 49 } |
56 InspectorTest.assertTrue(paintRecord, "Paint record with subframe paint
not found"); | 50 InspectorTest.assertTrue(paintRecord, "Paint record with subframe paint
not found"); |
57 var topQuad = paintRecord.data.clip; | 51 var topQuad = paintRecord.data.clip; |
58 var subframePaint = paintRecord.children[0]; | 52 var subframePaint = paintRecord.children[0]; |
59 var subframeQuad = subframePaint.data.clip; | 53 var subframeQuad = subframePaint.data.clip; |
60 InspectorTest.assertEquals(8, topQuad.length); | 54 InspectorTest.assertEquals(8, topQuad.length); |
61 InspectorTest.assertEquals(8, subframeQuad.length); | 55 InspectorTest.assertEquals(8, subframeQuad.length); |
(...skipping 13 matching lines...) Expand all Loading... |
75 </script> | 69 </script> |
76 </head> | 70 </head> |
77 | 71 |
78 <body onload="runTest()"> | 72 <body onload="runTest()"> |
79 <p> | 73 <p> |
80 Tests the Timeline API instrumentation of a paint event | 74 Tests the Timeline API instrumentation of a paint event |
81 </p> | 75 </p> |
82 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | 76 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> |
83 </body> | 77 </body> |
84 </html> | 78 </html> |
OLD | NEW |