| 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 var testElements = document.body.getElementsByClassName("testElement"); | 10 var testElements = document.body.getElementsByClassName("testElement"); |
| 11 for (var i = 0; i < testElements.length; i++) { | 11 for (var i = 0; i < testElements.length; i++) { |
| 12 testElements[i].style.color = "red"; | 12 testElements[i].style.color = "red"; |
| 13 testElements[i].style.backgroundColor = "blue"; | 13 testElements[i].style.backgroundColor = "blue"; |
| 14 } | 14 } |
| 15 if (window.testRunner) | 15 if (window.testRunner) |
| 16 testRunner.displayAsyncThen(callback); | 16 testRunner.displayAsyncThen(callback); |
| 17 }); | 17 }); |
| 18 } | 18 } |
| 19 | 19 |
| 20 function test() | 20 function test() |
| 21 { | 21 { |
| 22 var currentPanel = WebInspector.inspectorView.currentPanel(); | 22 var currentPanel = WebInspector.inspectorView.currentPanel(); |
| 23 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); | 23 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); |
| 24 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | 24 Runtime.experiments.enableForTest("timelineInvalidationTracking"); |
| 25 | 25 |
| 26 InspectorTest.invokeAsyncWithTimeline("display", function() { | 26 InspectorTest.invokeAsyncWithTimeline("display", function() { |
| 27 var record = InspectorTest.findFirstTimelineRecord(WebInspector.Timeline
Model.RecordType.Paint); | 27 var record = InspectorTest.findFirstTimelineRecord(WebInspector.Timeline
Model.RecordType.Paint); |
| 28 var invalidations = record._event.invalidationTrackingEvents; | 28 InspectorTest.addArray(record._event.invalidationTrackingEvents, Inspect
orTest.InvalidationFormatters, "", "paint invalidations"); |
| 29 InspectorTest.assertEquals(invalidations.length, 8); | |
| 30 for (var i = 0; i < 8; i++) { | |
| 31 InspectorTest.assertEquals(invalidations[i].type, WebInspector.Timel
ineModel.RecordType.StyleRecalcInvalidationTracking); | |
| 32 InspectorTest.assertEquals(invalidations[i].nodeName, "DIV class='te
stElement'"); | |
| 33 InspectorTest.assertEquals(invalidations[i].cause.reason, "Inline CS
S style declaration was mutated"); | |
| 34 InspectorTest.assertEquals(invalidations[i].cause.stackTrace.length,
1); | |
| 35 } | |
| 36 | 29 |
| 37 var linkifier = new WebInspector.Linkifier(); | 30 var linkifier = new WebInspector.Linkifier(); |
| 38 var target = InspectorTest.timelineModel().target(); | 31 var target = InspectorTest.timelineModel().target(); |
| 39 var contentHelper = new WebInspector.TimelineDetailsContentHelper(target
, linkifier, true); | 32 var contentHelper = new WebInspector.TimelineDetailsContentHelper(target
, linkifier, true); |
| 40 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent(), target
, contentHelper); | 33 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent(), target
, contentHelper); |
| 41 var invalidationGroups = contentHelper.element.getElementsByClassName("i
nvalidations-group"); | 34 var invalidationGroups = contentHelper.element.getElementsByClassName("i
nvalidations-group"); |
| 42 | 35 |
| 43 InspectorTest.assertEquals(invalidationGroups.length, 2); | 36 InspectorTest.assertEquals(invalidationGroups.length, 2); |
| 44 InspectorTest.assertEquals(invalidationGroups[0].textContent, | 37 InspectorTest.assertEquals(invalidationGroups[0].textContent, |
| 45 "Inline CSS style declaration was mutated for [ DIV class='testEleme
nt' ], [ DIV class='testElement' ], and 2 others. (anonymous function) @ timelin
e-grouped-invalidations.html:12"); | 38 "Inline CSS style declaration was mutated for [ DIV class='testEleme
nt' ], [ DIV class='testElement' ], and 2 others. (anonymous function) @ timelin
e-grouped-invalidations.html:12"); |
| 46 InspectorTest.assertEquals(invalidationGroups[1].textContent, | 39 InspectorTest.assertEquals(invalidationGroups[1].textContent, |
| 47 "Inline CSS style declaration was mutated for [ DIV class='testEleme
nt' ], [ DIV class='testElement' ], and 2 others. (anonymous function) @ timelin
e-grouped-invalidations.html:13"); | 40 "Inline CSS style declaration was mutated for [ DIV class='testEleme
nt' ], [ DIV class='testElement' ], and 2 others. (anonymous function) @ timelin
e-grouped-invalidations.html:13"); |
| 48 InspectorTest.completeTest(); | 41 InspectorTest.completeTest(); |
| 49 }); | 42 }); |
| 50 } | 43 } |
| 51 </script> | 44 </script> |
| 52 </head> | 45 </head> |
| 53 <body onload="runTest()"> | 46 <body onload="runTest()"> |
| 54 <p>Tests grouped invalidations on the timeline.</p> | 47 <p>Tests grouped invalidations on the timeline.</p> |
| 55 <div class="testElement">P</div><div class="testElement">A</div> | 48 <div class="testElement">P</div><div class="testElement">A</div> |
| 56 <div class="testElement">S</div><div class="testElement">S</div> | 49 <div class="testElement">S</div><div class="testElement">S</div> |
| 57 </body> | 50 </body> |
| 58 </html> | 51 </html> |
| OLD | NEW |