| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../http/tests/inspector/inspector-test.js"></script> | 4 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 5 <script src="../../http/tests/inspector/timeline-test.js"></script> | 5 <script src="../../http/tests/inspector/timeline-test.js"></script> |
| 6 <script> | 6 <script> |
| 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"; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 InspectorTest.assertEquals(invalidations[1].nodeName, "DIV id='t
estElement'"); | 44 InspectorTest.assertEquals(invalidations[1].nodeName, "DIV id='t
estElement'"); |
| 45 InspectorTest.assertEquals(invalidations[2].type, WebInspector.T
racingTimelineModel.RecordType.LayoutInvalidationTracking); | 45 InspectorTest.assertEquals(invalidations[2].type, WebInspector.T
racingTimelineModel.RecordType.LayoutInvalidationTracking); |
| 46 InspectorTest.assertEquals(invalidations[2].nodeName, "DIV id='t
estElement'"); | 46 InspectorTest.assertEquals(invalidations[2].nodeName, "DIV id='t
estElement'"); |
| 47 InspectorTest.assertGreaterOrEqual(invalidations[2].stackTrace.l
ength, 1); | 47 InspectorTest.assertGreaterOrEqual(invalidations[2].stackTrace.l
ength, 1); |
| 48 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay"
, next); | 48 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay"
, next); |
| 49 }); | 49 }); |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 function testSubframe(next) | 52 function testSubframe(next) |
| 53 { | 53 { |
| 54 // The first paint corresponds to the local frame and should have no
invalidations. |
| 54 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(WebInsp
ector.TimelineModel.RecordType.Paint); | 55 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(WebInsp
ector.TimelineModel.RecordType.Paint); |
| 55 var secondPaintRecord = undefined; | |
| 56 | |
| 57 function findSecondPaint(record) | |
| 58 { | |
| 59 if (record.type() !== WebInspector.TimelineModel.RecordType.Pain
t) | |
| 60 return false; | |
| 61 if (record === firstPaintRecord) | |
| 62 return false; | |
| 63 secondPaintRecord = record; | |
| 64 return true; | |
| 65 } | |
| 66 InspectorTest.timelineModel().forAllRecords(findSecondPaint); | |
| 67 | |
| 68 // The first paint corresponds to the local frame and should have no
invalidations. | |
| 69 var firstInvalidations = firstPaintRecord._event.invalidationTrackin
gEvents; | 56 var firstInvalidations = firstPaintRecord._event.invalidationTrackin
gEvents; |
| 70 InspectorTest.assertEquals(firstInvalidations, undefined); | 57 InspectorTest.assertEquals(firstInvalidations, undefined); |
| 71 | 58 |
| 72 // The second paint corresponds to the subframe and should have our
layout/style invalidations. | 59 // The second paint corresponds to the subframe and should have our
layout/style invalidations. |
| 60 var secondPaintRecord = InspectorTest.findTimelineRecord(WebInspecto
r.TimelineModel.RecordType.Paint, 1); |
| 73 var secondInvalidations = secondPaintRecord._event.invalidationTrack
ingEvents; | 61 var secondInvalidations = secondPaintRecord._event.invalidationTrack
ingEvents; |
| 74 InspectorTest.assertEquals(secondInvalidations.length, 3); | 62 InspectorTest.assertEquals(secondInvalidations.length, 3); |
| 75 InspectorTest.assertEquals(secondInvalidations[0].type, WebInspector
.TracingTimelineModel.RecordType.StyleRecalcInvalidationTracking); | 63 InspectorTest.assertEquals(secondInvalidations[0].type, WebInspector
.TracingTimelineModel.RecordType.StyleRecalcInvalidationTracking); |
| 76 InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV"); | 64 InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV"); |
| 77 InspectorTest.assertEquals(secondInvalidations[1].type, WebInspector
.TracingTimelineModel.RecordType.LayoutInvalidationTracking); | 65 InspectorTest.assertEquals(secondInvalidations[1].type, WebInspector
.TracingTimelineModel.RecordType.LayoutInvalidationTracking); |
| 78 InspectorTest.assertEquals(secondInvalidations[1].nodeName, "DIV"); | 66 InspectorTest.assertEquals(secondInvalidations[1].nodeName, "DIV"); |
| 79 InspectorTest.assertGreaterOrEqual(secondInvalidations[1].stackTrace
.length, 1); | 67 InspectorTest.assertGreaterOrEqual(secondInvalidations[1].stackTrace
.length, 1); |
| 80 InspectorTest.assertEquals(secondInvalidations[2].type, WebInspector
.TracingTimelineModel.RecordType.LayoutInvalidationTracking); | 68 InspectorTest.assertEquals(secondInvalidations[2].type, WebInspector
.TracingTimelineModel.RecordType.LayoutInvalidationTracking); |
| 81 InspectorTest.assertEquals(secondInvalidations[2].nodeName, "#docume
nt"); | 69 InspectorTest.assertEquals(secondInvalidations[2].nodeName, "#docume
nt"); |
| 82 InspectorTest.assertGreaterOrEqual(secondInvalidations[2].stackTrace
.length, 1); | 70 InspectorTest.assertGreaterOrEqual(secondInvalidations[2].stackTrace
.length, 1); |
| 83 next(); | 71 next(); |
| 84 } | 72 } |
| 85 ]); | 73 ]); |
| 86 } | 74 } |
| 87 </script> | 75 </script> |
| 88 </head> | 76 </head> |
| 89 <body onload="runTest()"> | 77 <body onload="runTest()"> |
| 90 <p>Tests the Timeline API instrumentation of paint events with layout invalidati
ons.</p> | 78 <p>Tests the Timeline API instrumentation of paint events with layout invalidati
ons.</p> |
| 91 <div id="testElement">PASS</div> | 79 <div id="testElement">PASS</div> |
| 92 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | 80 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> |
| 93 </body> | 81 </body> |
| 94 </html> | 82 </html> |
| OLD | NEW |