Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: LayoutTests/inspector/tracing/timeline-paint-with-layout-invalidations.html

Issue 786593002: Move invalidation tracking tests to the new InvalidationFormatters format (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 { 29 {
30 var currentPanel = WebInspector.inspectorView.currentPanel(); 30 var currentPanel = WebInspector.inspectorView.currentPanel();
31 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan el should be the timeline."); 31 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan el should be the timeline.");
32 Runtime.experiments.enableForTest("timelineInvalidationTracking"); 32 Runtime.experiments.enableForTest("timelineInvalidationTracking");
33 33
34 InspectorTest.runTestSuite([ 34 InspectorTest.runTestSuite([
35 function testLocalFrame(next) 35 function testLocalFrame(next)
36 { 36 {
37 InspectorTest.invokeAsyncWithTimeline("display", function() { 37 InspectorTest.invokeAsyncWithTimeline("display", function() {
38 var record = InspectorTest.findFirstTimelineRecord(WebInspector. TimelineModel.RecordType.Paint); 38 var record = InspectorTest.findFirstTimelineRecord(WebInspector. TimelineModel.RecordType.Paint);
39 var invalidations = record._event.invalidationTrackingEvents; 39 InspectorTest.addArray(record._event.invalidationTrackingEvents, InspectorTest.InvalidationFormatters, "", "paint invalidations");
40 InspectorTest.assertEquals(invalidations.length, 3);
41 InspectorTest.assertEquals(invalidations[0].type, WebInspector.T imelineModel.RecordType.StyleRecalcInvalidationTracking);
42 InspectorTest.assertEquals(invalidations[0].nodeName, "BODY");
43 InspectorTest.assertEquals(invalidations[0].cause.reason, "Inlin e CSS style declaration was mutated");
44 InspectorTest.assertEquals(invalidations[1].type, WebInspector.T imelineModel.RecordType.StyleRecalcInvalidationTracking);
45 InspectorTest.assertEquals(invalidations[1].nodeName, "DIV id='t estElement'");
46 InspectorTest.assertEquals(invalidations[1].cause.reason, "Inlin e CSS style declaration was mutated");
47 InspectorTest.assertEquals(invalidations[2].type, WebInspector.T imelineModel.RecordType.LayoutInvalidationTracking);
48 InspectorTest.assertEquals(invalidations[2].nodeName, "DIV id='t estElement'");
49 InspectorTest.assertGreaterOrEqual(invalidations[2].cause.stackT race.length, 1);
50 40
51 next(); 41 next();
52 }); 42 });
53 }, 43 },
54 44
55 function testSubframe(next) 45 function testSubframe(next)
56 { 46 {
57 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu nction() { 47 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu nction() {
58 // The first paint corresponds to the local frame and should hav e no invalidations. 48 // The first paint corresponds to the local frame and should hav e no invalidations.
59 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(Web Inspector.TimelineModel.RecordType.Paint); 49 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(Web Inspector.TimelineModel.RecordType.Paint);
60 var firstInvalidations = firstPaintRecord._event.invalidationTra ckingEvents; 50 var firstInvalidations = firstPaintRecord._event.invalidationTra ckingEvents;
61 InspectorTest.assertEquals(firstInvalidations, undefined); 51 InspectorTest.assertEquals(firstInvalidations, undefined);
62 52
63 // The second paint corresponds to the subframe and should have our layout/style invalidations. 53 // The second paint corresponds to the subframe and should have our layout/style invalidations.
64 var secondPaintRecord = InspectorTest.findTimelineRecord(WebInsp ector.TimelineModel.RecordType.Paint, 1); 54 var secondPaintRecord = InspectorTest.findTimelineRecord(WebInsp ector.TimelineModel.RecordType.Paint, 1);
65 var secondInvalidations = secondPaintRecord._event.invalidationT rackingEvents; 55 InspectorTest.addArray(secondPaintRecord._event.invalidationTrac kingEvents, InspectorTest.InvalidationFormatters, "", "second paint invalidation s");
66 InspectorTest.assertEquals(secondInvalidations.length, 3);
67 InspectorTest.assertEquals(secondInvalidations[0].type, WebInspe ctor.TimelineModel.RecordType.StyleRecalcInvalidationTracking);
68 InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV ");
69 InspectorTest.assertEquals(secondInvalidations[0].cause.reason, "Inline CSS style declaration was mutated");
70 InspectorTest.assertEquals(secondInvalidations[1].type, WebInspe ctor.TimelineModel.RecordType.LayoutInvalidationTracking);
71 InspectorTest.assertEquals(secondInvalidations[1].nodeName, "DIV ");
72 InspectorTest.assertGreaterOrEqual(secondInvalidations[1].cause. stackTrace.length, 1);
73 InspectorTest.assertEquals(secondInvalidations[2].type, WebInspe ctor.TimelineModel.RecordType.LayoutInvalidationTracking);
74 InspectorTest.assertEquals(secondInvalidations[2].nodeName, "#do cument");
75 InspectorTest.assertGreaterOrEqual(secondInvalidations[2].cause. stackTrace.length, 1);
76 56
77 next(); 57 next();
78 }); 58 });
79 } 59 }
80 ]); 60 ]);
81 } 61 }
82 </script> 62 </script>
83 </head> 63 </head>
84 <body onload="runTest()"> 64 <body onload="runTest()">
85 <p>Tests the Timeline API instrumentation of paint events with layout invalidati ons.</p> 65 <p>Tests the Timeline API instrumentation of paint events with layout invalidati ons.</p>
86 <div id="testElement">PASS</div> 66 <div id="testElement">PASS</div>
87 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe> 67 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>
88 </body> 68 </body>
89 </html> 69 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698