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

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

Issue 671913005: Implement layout invalidation tracking in devtools (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
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.getElementById("testElement").style.width = "100px";
11 var forceLayout1 = document.body.offsetTop;
12 document.getElementById("testElement").style.width = "110px";
13 var forceLayout2 = document.body.offsetTop;
14 if (window.testRunner)
15 testRunner.displayAsyncThen(callback);
16 });
17 }
18
19 function updateSubframeAndDisplay(callback)
20 {
21 requestAnimationFrame(function() {
22 frames[0].document.body.children[0].style.width = "10px";
23 var forceLayout1 = frames[0].document.body.offsetTop;
24 frames[0].document.body.children[0].style.width = "20px";
25 var forceLayout2 = frames[0].document.body.offsetTop;
26 if (window.testRunner)
27 testRunner.displayAsyncThen(callback);
28 });
29 }
30
31 function test()
32 {
33 var currentPanel = WebInspector.inspectorView.currentPanel();
34 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan el should be the timeline.");
35 Runtime.experiments.enableForTest("timelineInvalidationTracking");
36
37 InspectorTest.runTestSuite([
38 function testLocalFrame(next)
39 {
40 InspectorTest.invokeAsyncWithTimeline("display", function() {
41 var firstLayoutRecord = InspectorTest.findFirstTimelineRecord(We bInspector.TimelineModel.RecordType.Layout);
42 var firstInvalidations = firstLayoutRecord._event.invalidationTr ackingEvents;
43 InspectorTest.assertEquals(firstInvalidations.length, 1);
44 InspectorTest.assertEquals(firstInvalidations[0].type, WebInspec tor.TracingTimelineModel.RecordType.LayoutInvalidationTracking);
45 InspectorTest.assertEquals(firstInvalidations[0].nodeName, "DIV id='testElement'");
46 InspectorTest.assertGreaterOrEqual(firstInvalidations[0].stackTr ace.length, 1);
47
48 var secondLayoutRecord = InspectorTest.findTimelineRecord(WebIns pector.TimelineModel.RecordType.Layout, 1);
49 var secondInvalidations = secondLayoutRecord._event.invalidation TrackingEvents;
50 InspectorTest.assertEquals(secondInvalidations.length, 1);
51 InspectorTest.assertEquals(secondInvalidations[0].type, WebInspe ctor.TracingTimelineModel.RecordType.LayoutInvalidationTracking);
52 InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV id='testElement'");
53 InspectorTest.assertGreaterOrEqual(secondInvalidations[0].stackT race.length, 1);
54
55 next();
56 });
57 },
58
59 function testSubframe(next)
60 {
61 InspectorTest.invokeAsyncWithTimeline("updateSubframeAndDisplay", fu nction() {
62 var firstLayoutRecord = InspectorTest.findFirstTimelineRecord(We bInspector.TimelineModel.RecordType.Layout);
63 var firstInvalidations = firstLayoutRecord._event.invalidationTr ackingEvents;
64 InspectorTest.assertEquals(firstInvalidations.length, 1);
65 InspectorTest.assertEquals(firstInvalidations[0].type, WebInspec tor.TracingTimelineModel.RecordType.LayoutInvalidationTracking);
66 InspectorTest.assertEquals(firstInvalidations[0].nodeName, "DIV" );
67 InspectorTest.assertGreaterOrEqual(firstInvalidations[0].stackTr ace.length, 1);
68
69 var secondLayoutRecord = InspectorTest.findTimelineRecord(WebIns pector.TimelineModel.RecordType.Layout, 1);
70 var secondInvalidations = secondLayoutRecord._event.invalidation TrackingEvents;
71 InspectorTest.assertEquals(secondInvalidations.length, 1);
72 InspectorTest.assertEquals(secondInvalidations[0].type, WebInspe ctor.TracingTimelineModel.RecordType.LayoutInvalidationTracking);
73 InspectorTest.assertEquals(secondInvalidations[0].nodeName, "DIV ");
74 InspectorTest.assertGreaterOrEqual(secondInvalidations[0].stackT race.length, 1);
75
76 next();
77 });
78 }
79 ]);
80 }
81 </script>
82 </head>
83 <body onload="runTest()">
84 <p>Tests the Timeline API instrumentation of layout events with invalidations.</ p>
85 <div id="outerTestElement" style="display: inline-block;"><div id="testElement"> PASS</div></div>
86 <iframe src="resources/timeline-iframe-paint.html" style="position: absolute; le ft: 40px; top: 40px; width: 100px; height: 100px; border: none"></iframe>
87 </body>
88 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698