Chromium Code Reviews| Index: LayoutTests/inspector/tracing/timeline-layout-deleted-node-invalidations.html |
| diff --git a/LayoutTests/inspector/tracing/timeline-layout-deleted-node-invalidations.html b/LayoutTests/inspector/tracing/timeline-layout-deleted-node-invalidations.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..55656ede23e922e0b73cfd9fce4458cf12243f2a |
| --- /dev/null |
| +++ b/LayoutTests/inspector/tracing/timeline-layout-deleted-node-invalidations.html |
| @@ -0,0 +1,98 @@ |
| +<!DOCTYPE HTML> |
| +<html> |
| +<head> |
| +<script src="../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="../../http/tests/inspector/timeline-test.js"></script> |
| +<script> |
| +function display(callback) |
| +{ |
| + requestAnimationFrame(function() { |
| + document.body.style.backgroundColor = "blue"; |
| + var element = document.getElementsByTagName('p')[0]; |
|
caseq
2014/10/16 17:08:00
nit: assign an id and use getElementById(), it's e
pdr.
2014/10/17 05:07:03
Done (here, and in the other two tests). This also
|
| + element.style.width = "100px"; |
| + var forceLayout = document.body.offsetTop; |
| + element.parentElement.removeChild(element); |
| + if (window.testRunner) |
| + testRunner.displayAsyncThen(callback); |
| + }); |
| +} |
| + |
| +function updateSubframeAndDisplay(callback) |
| +{ |
| + requestAnimationFrame(function() { |
| + var element = frames[0].document.body.children[0]; |
| + element.style.width = "200px"; |
| + var forceLayout = document.body.offsetTop; |
| + element.parentElement.removeChild(element); |
| + if (window.testRunner) |
| + testRunner.displayAsyncThen(callback); |
| + }); |
| +} |
| + |
| +function test() |
| +{ |
| + var currentPanel = WebInspector.inspectorView.currentPanel(); |
| + InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current panel should be the timeline."); |
| + Runtime.experiments.enableForTest("timelineInvalidationTracking"); |
| + |
| + InspectorTest.runTestSuite([ |
| + function testLocalFrame(next) |
| + { |
| + InspectorTest.invokeAsyncWithTimeline("display", function() { |
| + var record = InspectorTest.findFirstTimelineRecord(WebInspector.TimelineModel.RecordType.Paint); |
| + var invalidations = record._event.invalidationTrackingEvents; |
| + InspectorTest.assertEquals(invalidations.length, 4); |
| + InspectorTest.assertEquals(invalidations[0].type, WebInspector.TracingTimelineModel.RecordType.StyleRecalcInvalidationTracking); |
| + InspectorTest.assertEquals(invalidations[0].nodeName, "BODY"); |
| + InspectorTest.assertEquals(invalidations[1].type, WebInspector.TracingTimelineModel.RecordType.StyleRecalcInvalidationTracking); |
| + InspectorTest.assertEquals(invalidations[1].nodeName, "P"); |
| + InspectorTest.assertEquals(invalidations[2].type, WebInspector.TracingTimelineModel.RecordType.LayoutInvalidationTracking); |
| + InspectorTest.assertEquals(invalidations[2].nodeName, "P"); |
| + InspectorTest.assertGreaterOrEqual(invalidations[2].callstack.length, 1); |
| + InspectorTest.assertEquals(invalidations[3].type, WebInspector.TracingTimelineModel.RecordType.LayoutInvalidationTracking); |
| + InspectorTest.assertEquals(invalidations[3].nodeName, "P"); |
| + InspectorTest.assertGreaterOrEqual(invalidations[3].callstack.length, 1); |
| + InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", next); |
| + }); |
| + }, |
| + |
| + function testSubframe(next) |
| + { |
| + var firstPaintRecord = InspectorTest.findFirstTimelineRecord(WebInspector.TimelineModel.RecordType.Paint); |
| + var secondPaintRecord = undefined; |
| + |
| + function findSecondPaint(record) |
| + { |
| + if (record.type() !== WebInspector.TimelineModel.RecordType.Paint) |
| + return false; |
| + if (record === firstPaintRecord) |
| + return false; |
| + secondPaintRecord = record; |
| + return true; |
| + } |
| + InspectorTest.timelineModel().forAllRecords(findSecondPaint); |
| + |
| + // The first paint corresponds to the local frame and should have no invalidations. |
| + var firstInvalidations = firstPaintRecord._event.invalidationTrackingEvents; |
| + InspectorTest.assertEquals(firstInvalidations, undefined); |
| + |
| + // The second paint corresponds to the subframe and should have our layout/style invalidations. |
| + var secondInvalidations = secondPaintRecord._event.invalidationTrackingEvents; |
| + InspectorTest.assertEquals(secondInvalidations.length, 2); |
| + InspectorTest.assertEquals(secondInvalidations[0].type, WebInspector.TracingTimelineModel.RecordType.StyleRecalcInvalidationTracking); |
| + InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV"); |
| + InspectorTest.assertEquals(secondInvalidations[1].type, WebInspector.TracingTimelineModel.RecordType.LayoutInvalidationTracking); |
| + InspectorTest.assertEquals(secondInvalidations[1].nodeName, "DIV"); |
| + InspectorTest.assertGreaterOrEqual(secondInvalidations[1].callstack.length, 1); |
| + next(); |
| + } |
| + ]); |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>FAIL - this should be removed during test execution.</p> |
| +<p>Tests the Timeline API instrumentation of layout invalidations on a deleted node.</p> |
| +<iframe src="resources/timeline-iframe-paint.html" style="position: absolute; left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> |
| +</body> |
| +</html> |