| 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(callback) |
| 8 { | 8 { |
| 9 requestAnimationFrame(function() { | 9 requestAnimationFrame(function() { |
| 10 document.body.style.backgroundColor = "blue"; | 10 document.body.style.backgroundColor = "blue"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 { | 27 { |
| 28 var currentPanel = WebInspector.inspectorView.currentPanel(); | 28 var currentPanel = WebInspector.inspectorView.currentPanel(); |
| 29 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."); |
| 30 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | 30 Runtime.experiments.enableForTest("timelineInvalidationTracking"); |
| 31 | 31 |
| 32 InspectorTest.runTestSuite([ | 32 InspectorTest.runTestSuite([ |
| 33 function testLocalFrame(next) | 33 function testLocalFrame(next) |
| 34 { | 34 { |
| 35 InspectorTest.invokeAsyncWithTimeline("display", function() { | 35 InspectorTest.invokeAsyncWithTimeline("display", function() { |
| 36 var record = InspectorTest.findFirstTimelineRecord(WebInspector.
TimelineModel.RecordType.Paint); | 36 var record = InspectorTest.findFirstTimelineRecord(WebInspector.
TimelineModel.RecordType.Paint); |
| 37 var invalidations = record._event.invalidationTrackingEvents; | 37 InspectorTest.addArray(record._event.invalidationTrackingEvents,
InspectorTest.InvalidationFormatters, "", "first paint invalidations"); |
| 38 InspectorTest.assertEquals(invalidations.length, 2); | |
| 39 InspectorTest.assertEquals(invalidations[0].type, WebInspector.T
imelineModel.RecordType.StyleRecalcInvalidationTracking); | |
| 40 InspectorTest.assertEquals(invalidations[0].nodeName, "BODY"); | |
| 41 InspectorTest.assertEquals(invalidations[0].cause.reason, "Inlin
e CSS style declaration was mutated"); | |
| 42 InspectorTest.assertEquals(invalidations[1].type, WebInspector.T
imelineModel.RecordType.StyleRecalcInvalidationTracking); | |
| 43 InspectorTest.assertEquals(invalidations[1].nodeName, "DIV id='t
estElement'"); | |
| 44 InspectorTest.assertEquals(invalidations[1].cause.reason, "Inlin
e CSS style declaration was mutated"); | |
| 45 | 38 |
| 46 next(); | 39 next(); |
| 47 }); | 40 }); |
| 48 }, | 41 }, |
| 49 | 42 |
| 50 function testSubframe(next) | 43 function testSubframe(next) |
| 51 { | 44 { |
| 52 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu
nction() { | 45 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu
nction() { |
| 53 // The first paint corresponds to the local frame and should hav
e no invalidations. | 46 // The first paint corresponds to the local frame and should hav
e no invalidations. |
| 54 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(Web
Inspector.TimelineModel.RecordType.Paint); | 47 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(Web
Inspector.TimelineModel.RecordType.Paint); |
| 55 var firstInvalidations = firstPaintRecord._event.invalidationTra
ckingEvents; | 48 var firstInvalidations = firstPaintRecord._event.invalidationTra
ckingEvents; |
| 56 InspectorTest.assertEquals(firstInvalidations, undefined); | 49 InspectorTest.assertEquals(firstInvalidations, undefined); |
| 57 | 50 |
| 58 // The second paint corresponds to the subframe and should have
our style invalidations. | 51 // The second paint corresponds to the subframe and should have
our style invalidations. |
| 59 var secondPaintRecord = InspectorTest.findTimelineRecord(WebInsp
ector.TimelineModel.RecordType.Paint, 1); | 52 var secondPaintRecord = InspectorTest.findTimelineRecord(WebInsp
ector.TimelineModel.RecordType.Paint, 1); |
| 60 var secondInvalidations = secondPaintRecord._event.invalidationT
rackingEvents; | 53 InspectorTest.addArray(secondPaintRecord._event.invalidationTrac
kingEvents, InspectorTest.InvalidationFormatters, "", "second paint invalidation
s"); |
| 61 InspectorTest.assertEquals(secondInvalidations.length, 1); | |
| 62 InspectorTest.assertEquals(secondInvalidations[0].type, WebInspe
ctor.TimelineModel.RecordType.StyleRecalcInvalidationTracking); | |
| 63 InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV
"); | |
| 64 InspectorTest.assertEquals(secondInvalidations[0].cause.reason,
"Inline CSS style declaration was mutated"); | |
| 65 | 54 |
| 66 next(); | 55 next(); |
| 67 }); | 56 }); |
| 68 } | 57 } |
| 69 ]); | 58 ]); |
| 70 } | 59 } |
| 71 </script> | 60 </script> |
| 72 </head> | 61 </head> |
| 73 <body onload="runTest()"> | 62 <body onload="runTest()"> |
| 74 <p>Tests the Timeline API instrumentation of paint events with style recalc inva
lidations.</p> | 63 <p>Tests the Timeline API instrumentation of paint events with style recalc inva
lidations.</p> |
| 75 <div id="testElement">PASS</div> | 64 <div id="testElement">PASS</div> |
| 76 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | 65 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le
ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> |
| 77 </body> | 66 </body> |
| 78 </html> | 67 </html> |
| OLD | NEW |