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 multipleStyleRecalcsAndDisplay(callback) | |
| 8 { | |
| 9 requestAnimationFrame(function() { | |
| 10 document.getElementById("testElementOne").className = "red"; | |
| 11 var forceStyleRecalc1 = document.body.offsetTop; | |
| 12 document.getElementById("testElementOne").className = "snow"; | |
| 13 var forceStyleRecalc2 = document.body.offsetTop; | |
| 14 if (window.testRunner) | |
| 15 testRunner.displayAsyncThen(callback); | |
| 16 }); | |
| 17 } | |
| 18 | |
| 19 function test() | |
| 20 { | |
| 21 var currentPanel = WebInspector.inspectorView.currentPanel(); | |
| 22 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan el should be the timeline."); | |
| 23 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | |
| 24 | |
| 25 InspectorTest.runTestSuite([ | |
|
caseq
2014/12/02 14:59:42
do you need a suite here?
pdr.
2014/12/03 04:33:53
Nope, fixed!
| |
| 26 function testMultipleStyleRecalcsChange(next) | |
| 27 { | |
| 28 InspectorTest.invokeAsyncWithTimeline("multipleStyleRecalcsAndDispla y", function() { | |
|
caseq
2014/12/02 14:59:42
please extract into a named function below, this w
pdr.
2014/12/03 04:33:53
Done.
| |
| 29 var firstRecalc = InspectorTest.findTimelineRecord(WebInspector. TimelineModel.RecordType.RecalculateStyles, 0); | |
| 30 InspectorTest.addArray(firstRecalc._event.invalidationTrackingEv ents, InspectorTest.InvalidationFormatters, "", "first style recalc"); | |
| 31 var secondRecalc = InspectorTest.findTimelineRecord(WebInspector .TimelineModel.RecordType.RecalculateStyles, 1); | |
| 32 InspectorTest.addArray(secondRecalc._event.invalidationTrackingE vents, InspectorTest.InvalidationFormatters, "", "second style recalc"); | |
| 33 var firstPaint = InspectorTest.findTimelineRecord(WebInspector.T imelineModel.RecordType.Paint, 0); | |
| 34 InspectorTest.addArray(firstPaint._event.invalidationTrackingEve nts, InspectorTest.InvalidationFormatters, "", "first paint"); | |
| 35 | |
| 36 var thirdRecalc = InspectorTest.findTimelineRecord(WebInspector. TimelineModel.RecordType.RecalculateStyles, 2); | |
| 37 InspectorTest.assertTrue(thirdRecalc === undefined, "There shoul d be no additional style recalc records."); | |
| 38 var secondPaint = InspectorTest.findTimelineRecord(WebInspector. TimelineModel.RecordType.Paint, 1); | |
| 39 InspectorTest.assertTrue(secondPaint === undefined, "There shoul d be no additional paint records."); | |
| 40 next(); | |
| 41 }); | |
| 42 } | |
| 43 ]); | |
| 44 } | |
| 45 </script> | |
| 46 <style> | |
| 47 .testHolder > .red { background-color: red; } | |
| 48 .testHolder > .green { background-color: green; } | |
| 49 .testHolder > .blue { background-color: blue; } | |
| 50 .testHolder > .snow { background-color: snow; } | |
| 51 </style> | |
| 52 </head> | |
| 53 <body onload="runTest()"> | |
| 54 <p>Tests the Timeline API instrumentation of multiple style recalc invalidations and ensures they are all collected on the paint event.</p> | |
| 55 <div class="testHolder"> | |
| 56 <div id="testElementOne">PASS</div><div id="testElementTwo">PASS</div><div id="t estElementThree">PASS</div> | |
| 57 </div> | |
| 58 </body> | |
| 59 </html> | |
| OLD | NEW |