| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 5 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
| 6 <script> | |
| 7 function display(callback) | |
| 8 { | |
| 9 requestAnimationFrame(function() { | |
| 10 document.body.style.backgroundColor = "blue"; | |
| 11 document.getElementById("testElement").style.width = "100px"; | |
| 12 var forceLayout = document.body.offsetTop; | |
| 13 if (window.testRunner) | |
| 14 testRunner.layoutAndPaintAsyncThen(callback); | |
| 15 }); | |
| 16 } | |
| 17 | |
| 18 function updateSubframeAndDisplay(callback) | |
| 19 { | |
| 20 requestAnimationFrame(function() { | |
| 21 frames[0].document.body.children[0].style.width = "200px"; | |
| 22 var forceLayout = frames[0].document.body.offsetTop; | |
| 23 if (window.testRunner) | |
| 24 testRunner.layoutAndPaintAsyncThen(callback); | |
| 25 }); | |
| 26 } | |
| 27 | |
| 28 function test() | |
| 29 { | |
| 30 var currentPanel = WebInspector.inspectorView.currentPanel(); | |
| 31 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); | |
| 32 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | |
| 33 | |
| 34 InspectorTest.runTestSuite([ | |
| 35 function testLocalFrame(next) | |
| 36 { | |
| 37 InspectorTest.invokeAsyncWithTimeline("display", function() { | |
| 38 var record = InspectorTest.findFirstTimelineRecord(WebInspector.
TimelineModel.RecordType.Paint); | |
| 39 InspectorTest.addArray(record._event.invalidationTrackingEvents,
InspectorTest.InvalidationFormatters, "", "paint invalidations"); | |
| 40 | |
| 41 next(); | |
| 42 }); | |
| 43 }, | |
| 44 | |
| 45 function testSubframe(next) | |
| 46 { | |
| 47 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu
nction() { | |
| 48 // The first paint corresponds to the local frame and should hav
e no invalidations. | |
| 49 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(Web
Inspector.TimelineModel.RecordType.Paint); | |
| 50 var firstInvalidations = firstPaintRecord._event.invalidationTra
ckingEvents; | |
| 51 InspectorTest.assertEquals(firstInvalidations, undefined); | |
| 52 | |
| 53 // The second paint corresponds to the subframe and should have
our layout/style invalidations. | |
| 54 var secondPaintRecord = InspectorTest.findTimelineRecord(WebInsp
ector.TimelineModel.RecordType.Paint, 1); | |
| 55 InspectorTest.addArray(secondPaintRecord._event.invalidationTrac
kingEvents, InspectorTest.InvalidationFormatters, "", "second paint invalidation
s"); | |
| 56 | |
| 57 next(); | |
| 58 }); | |
| 59 } | |
| 60 ]); | |
| 61 } | |
| 62 </script> | |
| 63 </head> | |
| 64 <body onload="runTest()"> | |
| 65 <p>Tests the Timeline API instrumentation of paint events with layout invalidati
ons.</p> | |
| 66 <div id="testElement">PASS</div> | |
| 67 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | |
| 68 </body> | |
| 69 </html> | |
| OLD | NEW |