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

Side by Side Diff: LayoutTests/inspector/tracing/timeline-event-causes.html

Issue 631573002: [Devtools] Replace "Stacks" with "Causes" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor cleanup 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 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
5 <script>
6 function test() {
caseq 2014/10/06 12:47:47 style: here and below, { => next line.
pdr. 2014/10/07 04:36:13 Done.
7 function checkStringContains(string, contains) {
8 var doesContain = string.indexOf(contains) >= 0;
9 InspectorTest.check(doesContain, contains + " should be present in " + s tring);
10 InspectorTest.addResult("PASS - record contained " + contains);
11 }
12
13 function testTimerInstall() {
14 function setTimeoutFunction(callback) {
15 setTimeout(function() {
caseq 2014/10/06 12:47:47 just setTimeout(callback, 0) perhaps?
pdr. 2014/10/07 04:36:13 Done.
16 callback();
17 }, 0);
18 }
19
20 var source = setTimeoutFunction.toString();
21 source += "\n//@ sourceURL=setTimeoutFunction.js";
22 InspectorTest.evaluateInPage(source);
23
24 InspectorTest.invokeAsyncWithTimeline("setTimeoutFunction", finishAndRun NextTest);
25 function finishAndRunNextTest() {
26 var linkifier = new WebInspector.Linkifier();
27 var record = InspectorTest.findFirstTimelineRecord("TimerFire");
28 InspectorTest.check(record, "Should receive a TimerFire record.");
29 WebInspector.TracingTimelineUIUtils.generateCausesContent(record.tra ceEvent(), linkifier, function(result) {
30 checkStringContains(result.textContent, "Timer installed: setTim eoutFunction @ setTimeoutFunction.js:");
31 testRequestAnimationFrame();
32 });
33 }
34 }
35
36 function testRequestAnimationFrame() {
37 function requestAnimationFrameFunction(callback) {
38 requestAnimationFrame(function() {
39 callback();
40 });
41 }
42
43 var source = requestAnimationFrameFunction.toString();
44 source += "\n//@ sourceURL=requestAnimationFrameFunction.js";
45 InspectorTest.evaluateInPage(source);
46
47 InspectorTest.invokeAsyncWithTimeline("requestAnimationFrameFunction", f inishAndRunNextTest);
48 function finishAndRunNextTest() {
49 var linkifier = new WebInspector.Linkifier();
50 var record = InspectorTest.findFirstTimelineRecord("FireAnimationFra me");
51 InspectorTest.check(record, "Should receive a FireAnimationFrame rec ord.");
52 WebInspector.TracingTimelineUIUtils.generateCausesContent(record.tra ceEvent(), linkifier, function(result) {
53 checkStringContains(result.textContent, "Animation frame request ed: requestAnimationFrameFunction @ requestAnimationFrameFunction.js:");
54 testStyleRecalc();
55 });
56 }
57 }
58
59 function testStyleRecalc() {
60 function styleRecalcFunction(callback) {
61 var element = document.getElementById("testElement");
62 element.style.backgroundColor = "papayawhip";
63 callback();
64 }
65
66 var source = styleRecalcFunction.toString();
67 source += "\n//@ sourceURL=styleRecalcFunction.js";
68 InspectorTest.evaluateInPage(source);
69
70 InspectorTest.invokeAsyncWithTimeline("styleRecalcFunction", finishAndRu nNextTest);
71 function finishAndRunNextTest() {
72 var linkifier = new WebInspector.Linkifier();
73 var record = InspectorTest.findFirstTimelineRecord("RecalculateStyle s");
74 InspectorTest.check(record, "Should receive a RecalculateStyles reco rd.");
75 WebInspector.TracingTimelineUIUtils.generateCausesContent(record.tra ceEvent(), linkifier, function(result) {
76 checkStringContains(result.textContent, "Stack when first invali dated: styleRecalcFunction @ styleRecalcFunction.js:");
77 testLayout();
78 });
79 }
80 }
81
82 function testLayout() {
83 function layoutFunction(callback) {
84 var element = document.getElementById("testElement");
85 element.style.width = "200px";
86 var forceLayout = element.offsetWidth;
87 callback();
88 }
89
90 var source = layoutFunction.toString();
91 source += "\n//@ sourceURL=layoutFunction.js";
92 InspectorTest.evaluateInPage(source);
93
94 InspectorTest.invokeAsyncWithTimeline("layoutFunction", finishAndRunNext Test);
95 function finishAndRunNextTest() {
96 var linkifier = new WebInspector.Linkifier();
97 var record = InspectorTest.findFirstTimelineRecord("Layout");
98 InspectorTest.check(record, "Should receive a Layout record.");
99 WebInspector.TracingTimelineUIUtils.generateCausesContent(record.tra ceEvent(), linkifier, function(result) {
100 checkStringContains(result.textContent, "Stack when layout was f orced: layoutFunction @ layoutFunction.js:");
101 checkStringContains(result.textContent, "First layout invalidati on: layoutFunction @ layoutFunction.js:");
102 InspectorTest.completeTest();
103 });
104 }
105 }
106
107 // Begin the test.
108 testTimerInstall();
109 }
110 </script>
111 </head>
112
113 <body onload="runTest()">
114 <p>
115 Test that causes are correctly generated for various types of events.
116 </p>
117 <div id="testElement"></div>
118 </body>
119 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698