Chromium Code Reviews| 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 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
| |
| 12 element.style.width = "100px"; | |
| 13 var forceLayout = document.body.offsetTop; | |
| 14 element.parentElement.removeChild(element); | |
| 15 if (window.testRunner) | |
| 16 testRunner.displayAsyncThen(callback); | |
| 17 }); | |
| 18 } | |
| 19 | |
| 20 function updateSubframeAndDisplay(callback) | |
| 21 { | |
| 22 requestAnimationFrame(function() { | |
| 23 var element = frames[0].document.body.children[0]; | |
| 24 element.style.width = "200px"; | |
| 25 var forceLayout = document.body.offsetTop; | |
| 26 element.parentElement.removeChild(element); | |
| 27 if (window.testRunner) | |
| 28 testRunner.displayAsyncThen(callback); | |
| 29 }); | |
| 30 } | |
| 31 | |
| 32 function test() | |
| 33 { | |
| 34 var currentPanel = WebInspector.inspectorView.currentPanel(); | |
| 35 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan el should be the timeline."); | |
| 36 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | |
| 37 | |
| 38 InspectorTest.runTestSuite([ | |
| 39 function testLocalFrame(next) | |
| 40 { | |
| 41 InspectorTest.invokeAsyncWithTimeline("display", function() { | |
| 42 var record = InspectorTest.findFirstTimelineRecord(WebInspector. TimelineModel.RecordType.Paint); | |
| 43 var invalidations = record._event.invalidationTrackingEvents; | |
| 44 InspectorTest.assertEquals(invalidations.length, 4); | |
| 45 InspectorTest.assertEquals(invalidations[0].type, WebInspector.T racingTimelineModel.RecordType.StyleRecalcInvalidationTracking); | |
| 46 InspectorTest.assertEquals(invalidations[0].nodeName, "BODY"); | |
| 47 InspectorTest.assertEquals(invalidations[1].type, WebInspector.T racingTimelineModel.RecordType.StyleRecalcInvalidationTracking); | |
| 48 InspectorTest.assertEquals(invalidations[1].nodeName, "P"); | |
| 49 InspectorTest.assertEquals(invalidations[2].type, WebInspector.T racingTimelineModel.RecordType.LayoutInvalidationTracking); | |
| 50 InspectorTest.assertEquals(invalidations[2].nodeName, "P"); | |
| 51 InspectorTest.assertGreaterOrEqual(invalidations[2].callstack.le ngth, 1); | |
| 52 InspectorTest.assertEquals(invalidations[3].type, WebInspector.T racingTimelineModel.RecordType.LayoutInvalidationTracking); | |
| 53 InspectorTest.assertEquals(invalidations[3].nodeName, "P"); | |
| 54 InspectorTest.assertGreaterOrEqual(invalidations[3].callstack.le ngth, 1); | |
| 55 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay" , next); | |
| 56 }); | |
| 57 }, | |
| 58 | |
| 59 function testSubframe(next) | |
| 60 { | |
| 61 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(WebInsp ector.TimelineModel.RecordType.Paint); | |
| 62 var secondPaintRecord = undefined; | |
| 63 | |
| 64 function findSecondPaint(record) | |
| 65 { | |
| 66 if (record.type() !== WebInspector.TimelineModel.RecordType.Pain t) | |
| 67 return false; | |
| 68 if (record === firstPaintRecord) | |
| 69 return false; | |
| 70 secondPaintRecord = record; | |
| 71 return true; | |
| 72 } | |
| 73 InspectorTest.timelineModel().forAllRecords(findSecondPaint); | |
| 74 | |
| 75 // The first paint corresponds to the local frame and should have no invalidations. | |
| 76 var firstInvalidations = firstPaintRecord._event.invalidationTrackin gEvents; | |
| 77 InspectorTest.assertEquals(firstInvalidations, undefined); | |
| 78 | |
| 79 // The second paint corresponds to the subframe and should have our layout/style invalidations. | |
| 80 var secondInvalidations = secondPaintRecord._event.invalidationTrack ingEvents; | |
| 81 InspectorTest.assertEquals(secondInvalidations.length, 2); | |
| 82 InspectorTest.assertEquals(secondInvalidations[0].type, WebInspector .TracingTimelineModel.RecordType.StyleRecalcInvalidationTracking); | |
| 83 InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV"); | |
| 84 InspectorTest.assertEquals(secondInvalidations[1].type, WebInspector .TracingTimelineModel.RecordType.LayoutInvalidationTracking); | |
| 85 InspectorTest.assertEquals(secondInvalidations[1].nodeName, "DIV"); | |
| 86 InspectorTest.assertGreaterOrEqual(secondInvalidations[1].callstack. length, 1); | |
| 87 next(); | |
| 88 } | |
| 89 ]); | |
| 90 } | |
| 91 </script> | |
| 92 </head> | |
| 93 <body onload="runTest()"> | |
| 94 <p>FAIL - this should be removed during test execution.</p> | |
| 95 <p>Tests the Timeline API instrumentation of layout invalidations on a deleted n ode.</p> | |
| 96 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | |
| 97 </body> | |
| 98 </html> | |
| OLD | NEW |