| 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() | 7 function display() |
| 8 { | 8 { |
| 9 document.body.style.backgroundColor = "blue"; | 9 document.body.style.backgroundColor = "blue"; |
| 10 document.getElementById("testElement").style.backgroundColor = "salmon"; | 10 document.getElementById("testElement").style.backgroundColor = "salmon"; |
| 11 return waitForFrame(); | 11 return waitForFrame(); |
| 12 } | 12 } |
| 13 | 13 |
| 14 function updateSubframeAndDisplay() | 14 function updateSubframeAndDisplay() |
| 15 { | 15 { |
| 16 frames[0].document.body.children[0].style.backgroundColor = "green"; | 16 frames[0].document.body.children[0].style.backgroundColor = "green"; |
| 17 return waitForFrame(); | 17 return waitForFrame(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 function test() | 20 function test() |
| 21 { | 21 { |
| 22 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | 22 Runtime.experiments.enableForTest("timelineInvalidationTracking"); |
| 23 | 23 |
| 24 InspectorTest.runTestSuite([ | 24 InspectorTest.runTestSuite([ |
| 25 function testLocalFrame(next) | 25 function testLocalFrame(next) |
| 26 { | 26 { |
| 27 InspectorTest.invokeAsyncWithTimeline("display", function() { | 27 InspectorTest.invokeAsyncWithTimeline("display", function() { |
| 28 var record = InspectorTest.findFirstTimelineRecord(WebInspector.
TimelineModel.RecordType.Paint); | 28 InspectorTest.dumpInvalidations(WebInspector.TimelineModel.Recor
dType.Paint, 0, "first paint invalidations"); |
| 29 InspectorTest.addArray(record._event.invalidationTrackingEvents,
InspectorTest.InvalidationFormatters, "", "first paint invalidations"); | |
| 30 | |
| 31 next(); | 29 next(); |
| 32 }); | 30 }); |
| 33 }, | 31 }, |
| 34 | 32 |
| 35 function testSubframe(next) | 33 function testSubframe(next) |
| 36 { | 34 { |
| 37 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu
nction() { | 35 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu
nction() { |
| 38 // The first paint corresponds to the local frame and should hav
e no invalidations. | 36 // The first paint corresponds to the local frame and should hav
e no invalidations. |
| 39 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(Web
Inspector.TimelineModel.RecordType.Paint); | 37 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(Web
Inspector.TimelineModel.RecordType.Paint); |
| 40 var firstInvalidations = firstPaintRecord._event.invalidationTra
ckingEvents; | 38 var firstInvalidations = WebInspector.InvalidationTracker.invali
dationEventsFor(firstPaintRecord._event); |
| 41 InspectorTest.assertEquals(firstInvalidations, undefined); | 39 InspectorTest.assertEquals(firstInvalidations, null); |
| 42 | 40 |
| 43 // The second paint corresponds to the subframe and should have
our style invalidations. | 41 // The second paint corresponds to the subframe and should have
our style invalidations. |
| 44 var secondPaintRecord = InspectorTest.findTimelineRecord(WebInsp
ector.TimelineModel.RecordType.Paint, 1); | 42 InspectorTest.dumpInvalidations(WebInspector.TimelineModel.Recor
dType.Paint, 1, "second paint invalidations"); |
| 45 InspectorTest.addArray(secondPaintRecord._event.invalidationTrac
kingEvents, InspectorTest.InvalidationFormatters, "", "second paint invalidation
s"); | |
| 46 | |
| 47 next(); | 43 next(); |
| 48 }); | 44 }); |
| 49 } | 45 } |
| 50 ]); | 46 ]); |
| 51 } | 47 } |
| 52 </script> | 48 </script> |
| 53 </head> | 49 </head> |
| 54 <body onload="runTest()"> | 50 <body onload="runTest()"> |
| 55 <p>Tests the Timeline API instrumentation of paint events with style recalc inva
lidations.</p> | 51 <p>Tests the Timeline API instrumentation of paint events with style recalc inva
lidations.</p> |
| 56 <div id="testElement">PASS</div> | 52 <div id="testElement">PASS</div> |
| 57 <iframe src="../resources/timeline-iframe-paint.html" style="position: absolute;
left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> | 53 <iframe src="../resources/timeline-iframe-paint.html" style="position: absolute;
left: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> |
| 58 </body> | 54 </body> |
| 59 </html> | 55 </html> |
| OLD | NEW |