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