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"); |
(...skipping 13 matching lines...) Expand all Loading... |
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 InspectorTest.addArray(record._event.invalidationTrackingEvents, Inspect
orTest.InvalidationFormatters, "", "paint invalidations"); | 28 InspectorTest.addArray(record._event.invalidationTrackingEvents, Inspect
orTest.InvalidationFormatters, "", "paint invalidations"); |
29 | 29 |
30 var linkifier = new WebInspector.Linkifier(); | 30 var linkifier = new WebInspector.Linkifier(); |
31 var target = InspectorTest.timelineModel().target(); | 31 var target = InspectorTest.timelineModel().target(); |
32 var contentHelper = new WebInspector.TimelineDetailsContentHelper(target
, linkifier, null, true); | 32 var contentHelper = new WebInspector.TimelineDetailsContentHelper(target
, linkifier, null, true); |
33 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent(), target
, contentHelper); | 33 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent(), target
, contentHelper); |
34 var invalidationGroups = contentHelper.element.getElementsByClassName("i
nvalidations-group"); | 34 var invalidationsTree = contentHelper.element.getElementsByClassName("in
validations-tree")[0]; |
35 | 35 var invalidations = invalidationsTree.shadowRoot.textContent; |
36 InspectorTest.assertEquals(invalidationGroups.length, 2); | 36 checkStringContains(invalidations, "Inline CSS style declaration was mut
ated for [ DIV class='testElement' ], [ DIV class='testElement' ], and 2 others.
(anonymous function) @ timeline-grouped-invalidations.html:12"); |
37 InspectorTest.assertEquals(invalidationGroups[0].textContent, | 37 checkStringContains(invalidations, "Inline CSS style declaration was mut
ated for [ DIV class='testElement' ], [ DIV class='testElement' ], and 2 others.
(anonymous function) @ timeline-grouped-invalidations.html:13"); |
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"); | |
39 InspectorTest.assertEquals(invalidationGroups[1].textContent, | |
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"); | |
41 InspectorTest.completeTest(); | 38 InspectorTest.completeTest(); |
42 }); | 39 }); |
| 40 |
| 41 function checkStringContains(string, contains) |
| 42 { |
| 43 var doesContain = string.indexOf(contains) >= 0; |
| 44 InspectorTest.check(doesContain, contains + " should be present in " + s
tring); |
| 45 InspectorTest.addResult("PASS - record contained " + contains); |
| 46 } |
43 } | 47 } |
44 </script> | 48 </script> |
45 </head> | 49 </head> |
46 <body onload="runTest()"> | 50 <body onload="runTest()"> |
47 <p>Tests grouped invalidations on the timeline.</p> | 51 <p>Tests grouped invalidations on the timeline.</p> |
48 <div class="testElement">P</div><div class="testElement">A</div> | 52 <div class="testElement">P</div><div class="testElement">A</div> |
49 <div class="testElement">S</div><div class="testElement">S</div> | 53 <div class="testElement">S</div><div class="testElement">S</div> |
50 </body> | 54 </body> |
51 </html> | 55 </html> |
OLD | NEW |