| 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.getElementById("testElement").style.width = "100px"; | |
| 11 var forceLayout1 = document.body.offsetTop; | |
| 12 document.getElementById("testElement").style.width = "110px"; | |
| 13 var forceLayout2 = document.body.offsetTop; | |
| 14 if (window.testRunner) | |
| 15 testRunner.layoutAndPaintAsyncThen(callback); | |
| 16 }); | |
| 17 } | |
| 18 | |
| 19 function updateSubframeAndDisplay(callback) | |
| 20 { | |
| 21 requestAnimationFrame(function() { | |
| 22 frames[0].document.body.children[0].style.width = "10px"; | |
| 23 var forceLayout1 = frames[0].document.body.offsetTop; | |
| 24 frames[0].document.body.children[0].style.width = "20px"; | |
| 25 var forceLayout2 = frames[0].document.body.offsetTop; | |
| 26 if (window.testRunner) | |
| 27 testRunner.layoutAndPaintAsyncThen(callback); | |
| 28 }); | |
| 29 } | |
| 30 | |
| 31 function test() | |
| 32 { | |
| 33 var currentPanel = WebInspector.inspectorView.currentPanel(); | |
| 34 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); | |
| 35 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | |
| 36 | |
| 37 InspectorTest.runTestSuite([ | |
| 38 function testLocalFrame(next) | |
| 39 { | |
| 40 InspectorTest.invokeAsyncWithTimeline("display", function() { | |
| 41 var firstLayoutRecord = InspectorTest.findFirstTimelineRecord(We
bInspector.TimelineModel.RecordType.Layout); | |
| 42 InspectorTest.addArray(firstLayoutRecord._event.invalidationTrac
kingEvents, InspectorTest.InvalidationFormatters, "", "first layout invalidation
s"); | |
| 43 | |
| 44 var secondLayoutRecord = InspectorTest.findTimelineRecord(WebIns
pector.TimelineModel.RecordType.Layout, 1); | |
| 45 InspectorTest.addArray(secondLayoutRecord._event.invalidationTra
ckingEvents, InspectorTest.InvalidationFormatters, "", "second layout invalidati
ons"); | |
| 46 | |
| 47 next(); | |
| 48 }); | |
| 49 }, | |
| 50 | |
| 51 function testSubframe(next) | |
| 52 { | |
| 53 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu
nction() { | |
| 54 var firstLayoutRecord = InspectorTest.findFirstTimelineRecord(We
bInspector.TimelineModel.RecordType.Layout); | |
| 55 InspectorTest.addArray(firstLayoutRecord._event.invalidationTrac
kingEvents, InspectorTest.InvalidationFormatters, "", "first layout invalidation
s"); | |
| 56 | |
| 57 var secondLayoutRecord = InspectorTest.findTimelineRecord(WebIns
pector.TimelineModel.RecordType.Layout, 1); | |
| 58 InspectorTest.addArray(secondLayoutRecord._event.invalidationTra
ckingEvents, InspectorTest.InvalidationFormatters, "", "second layout invalidati
ons"); | |
| 59 | |
| 60 next(); | |
| 61 }); | |
| 62 } | |
| 63 ]); | |
| 64 } | |
| 65 </script> | |
| 66 </head> | |
| 67 <body onload="runTest()"> | |
| 68 <p>Tests the Timeline API instrumentation of layout events with invalidations.</
p> | |
| 69 <div id="outerTestElement" style="display: inline-block;"><div id="testElement">
PASS</div></div> | |
| 70 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | |
| 71 </body> | |
| 72 </html> | |
| OLD | NEW |