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

Side by Side Diff: LayoutTests/inspector/tracing/timeline-layout-deleted-node-invalidations.html

Issue 653283005: Implement style recalc invalidation tracking in devtools (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix minor typeo: _addInvalidationTrackingEvent Created 6 years, 2 months 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
« no previous file with comments | « no previous file | LayoutTests/inspector/tracing/timeline-layout-deleted-node-invalidations-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 display(callback)
8 {
9 requestAnimationFrame(function() {
10 document.body.style.backgroundColor = "blue";
11 var element = document.getElementById("testElement");
12 element.style.width = "100px";
13 var forceLayout = document.body.offsetTop;
14 element.parentElement.removeChild(element);
15 if (window.testRunner)
16 testRunner.displayAsyncThen(callback);
17 });
18 }
19
20 function updateSubframeAndDisplay(callback)
21 {
22 requestAnimationFrame(function() {
23 var element = frames[0].document.body.children[0];
24 element.style.width = "200px";
25 var forceLayout = frames[0].document.body.offsetTop;
26 element.parentElement.removeChild(element);
27 if (window.testRunner)
28 testRunner.displayAsyncThen(callback);
29 });
30 }
31
32 function test()
33 {
34 var currentPanel = WebInspector.inspectorView.currentPanel();
35 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan el should be the timeline.");
36 Runtime.experiments.enableForTest("timelineInvalidationTracking");
37
38 InspectorTest.runTestSuite([
39 function testLocalFrame(next)
40 {
41 InspectorTest.invokeAsyncWithTimeline("display", function() {
42 var record = InspectorTest.findFirstTimelineRecord(WebInspector. TimelineModel.RecordType.Paint);
43 var invalidations = record._event.invalidationTrackingEvents;
44 InspectorTest.assertEquals(invalidations.length, 4);
45 InspectorTest.assertEquals(invalidations[0].type, WebInspector.T racingTimelineModel.RecordType.StyleRecalcInvalidationTracking);
46 InspectorTest.assertEquals(invalidations[0].nodeName, "BODY");
47 InspectorTest.assertEquals(invalidations[1].type, WebInspector.T racingTimelineModel.RecordType.StyleRecalcInvalidationTracking);
48 InspectorTest.assertEquals(invalidations[1].nodeName, "DIV id='t estElement'");
49 InspectorTest.assertEquals(invalidations[2].type, WebInspector.T racingTimelineModel.RecordType.LayoutInvalidationTracking);
50 InspectorTest.assertEquals(invalidations[2].nodeName, "DIV id='t estElement'");
51 InspectorTest.assertGreaterOrEqual(invalidations[2].stackTrace.l ength, 1);
52 InspectorTest.assertEquals(invalidations[3].type, WebInspector.T racingTimelineModel.RecordType.LayoutInvalidationTracking);
53 InspectorTest.assertEquals(invalidations[3].nodeName, "DIV id='t estElement'");
54 InspectorTest.assertGreaterOrEqual(invalidations[3].stackTrace.l ength, 1);
55 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay" , next);
56 });
57 },
58
59 function testSubframe(next)
60 {
61 var firstPaintRecord = InspectorTest.findFirstTimelineRecord(WebInsp ector.TimelineModel.RecordType.Paint);
62 var secondPaintRecord = undefined;
63
64 function findSecondPaint(record)
65 {
66 if (record.type() !== WebInspector.TimelineModel.RecordType.Pain t)
67 return false;
68 if (record === firstPaintRecord)
69 return false;
70 secondPaintRecord = record;
71 return true;
72 }
73 InspectorTest.timelineModel().forAllRecords(findSecondPaint);
74
75 // The first paint corresponds to the local frame and should have no invalidations.
76 var firstInvalidations = firstPaintRecord._event.invalidationTrackin gEvents;
77 InspectorTest.assertEquals(firstInvalidations, undefined);
78
79 // The second paint corresponds to the subframe and should have our layout/style invalidations.
80 var secondInvalidations = secondPaintRecord._event.invalidationTrack ingEvents;
81 InspectorTest.assertEquals(secondInvalidations.length, 3);
82 InspectorTest.assertEquals(secondInvalidations[0].type, WebInspector .TracingTimelineModel.RecordType.StyleRecalcInvalidationTracking);
83 InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV");
84 InspectorTest.assertEquals(secondInvalidations[1].type, WebInspector .TracingTimelineModel.RecordType.LayoutInvalidationTracking);
85 InspectorTest.assertEquals(secondInvalidations[1].nodeName, "DIV");
86 InspectorTest.assertGreaterOrEqual(secondInvalidations[1].stackTrace .length, 1);
87 InspectorTest.assertEquals(secondInvalidations[2].type, WebInspector .TracingTimelineModel.RecordType.LayoutInvalidationTracking);
88 InspectorTest.assertEquals(secondInvalidations[2].nodeName, "DIV");
89 InspectorTest.assertGreaterOrEqual(secondInvalidations[2].stackTrace .length, 1);
90 next();
91 }
92 ]);
93 }
94 </script>
95 </head>
96 <body onload="runTest()">
97 <p>Tests the Timeline API instrumentation of layout invalidations on a deleted n ode.</p>
98 <div id="testElement">FAIL - this should not be present when the test finishes.< /div>
99 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>
100 </body>
101 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/tracing/timeline-layout-deleted-node-invalidations-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698