Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / tracing / timeline-event-causes.html
blob1426ba2e99926d2c668f58026c62322fd7b50f93
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()
8 function checkStringContains(string, contains)
10 var doesContain = string.indexOf(contains) >= 0;
11 InspectorTest.check(doesContain, contains + " should be present in " + string);
12 InspectorTest.addResult("PASS - record contained " + contains);
15 InspectorTest.runTestSuite([
16 function testTimerInstall(next)
18 function setTimeoutFunction(callback)
20 setTimeout(callback, 0);
23 var source = setTimeoutFunction.toString();
24 source += "\n//@ sourceURL=setTimeoutFunction.js";
25 InspectorTest.evaluateInPage(source);
27 InspectorTest.invokeAsyncWithTimeline("setTimeoutFunction", finishAndRunNextTest);
28 function finishAndRunNextTest()
30 var linkifier = new WebInspector.Linkifier();
31 var record = InspectorTest.findFirstTimelineRecord("TimerFire");
32 InspectorTest.check(record, "Should receive a TimerFire record.");
33 var contentHelper = new WebInspector.TimelineDetailsContentHelper(InspectorTest.timelineModel().target(), linkifier, null, true);
34 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent(), InspectorTest.timelineModel().target(), contentHelper);
35 var causes = contentHelper.element.deepTextContent();
36 InspectorTest.check(causes, "Should generate causes");
37 checkStringContains(causes, "Timer installedsetTimeoutFunction @ setTimeoutFunction.js:");
38 next();
42 function testRequestAnimationFrame(next)
44 function requestAnimationFrameFunction(callback)
46 requestAnimationFrame(callback);
49 var source = requestAnimationFrameFunction.toString();
50 source += "\n//@ sourceURL=requestAnimationFrameFunction.js";
51 InspectorTest.evaluateInPage(source);
53 InspectorTest.invokeAsyncWithTimeline("requestAnimationFrameFunction", finishAndRunNextTest);
54 function finishAndRunNextTest()
56 var linkifier = new WebInspector.Linkifier();
57 var record = InspectorTest.findFirstTimelineRecord("FireAnimationFrame");
58 InspectorTest.check(record, "Should receive a FireAnimationFrame record.");
59 var contentHelper = new WebInspector.TimelineDetailsContentHelper(InspectorTest.timelineModel().target(), linkifier, null, true);
60 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent(), InspectorTest.timelineModel().target(), contentHelper);
61 var causes = contentHelper.element.deepTextContent();
62 InspectorTest.check(causes, "Should generate causes");
63 checkStringContains(causes, "Animation frame requestedrequestAnimationFrameFunction @ requestAnimationFrameFunction.js:");
64 next();
68 function testStyleRecalc(next)
70 function styleRecalcFunction()
72 var element = document.getElementById("testElement");
73 element.style.backgroundColor = "papayawhip";
74 var forceLayout = element.offsetWidth;
77 var source = styleRecalcFunction.toString();
78 source += "\n//@ sourceURL=styleRecalcFunction.js";
79 InspectorTest.evaluateInPage(source);
81 InspectorTest.evaluateWithTimeline("styleRecalcFunction()", finishAndRunNextTest);
82 function finishAndRunNextTest()
84 var linkifier = new WebInspector.Linkifier();
85 var record = InspectorTest.findFirstTimelineRecord("UpdateLayoutTree");
86 InspectorTest.check(record, "Should receive a UpdateLayoutTree record.");
87 var contentHelper = new WebInspector.TimelineDetailsContentHelper(InspectorTest.timelineModel().target(), linkifier, null, true);
88 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent(), InspectorTest.timelineModel().target(), contentHelper);
89 var causes = contentHelper.element.deepTextContent();
90 InspectorTest.check(causes, "Should generate causes");
91 checkStringContains(causes, "First invalidatedstyleRecalcFunction @ styleRecalcFunction.js:");
92 next();
96 function testLayout(next)
98 function layoutFunction()
100 var element = document.getElementById("testElement");
101 element.style.width = "200px";
102 var forceLayout = element.offsetWidth;
105 var source = layoutFunction.toString();
106 source += "\n//@ sourceURL=layoutFunction.js";
107 InspectorTest.evaluateInPage(source);
109 InspectorTest.evaluateWithTimeline("layoutFunction()", finishAndRunNextTest);
110 function finishAndRunNextTest()
112 var linkifier = new WebInspector.Linkifier();
113 var record = InspectorTest.findFirstTimelineRecord("Layout");
114 InspectorTest.check(record, "Should receive a Layout record.");
115 var contentHelper = new WebInspector.TimelineDetailsContentHelper(InspectorTest.timelineModel().target(), linkifier, null, true);
116 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent(), InspectorTest.timelineModel().target(), contentHelper);
117 var causes = contentHelper.element.deepTextContent();
118 InspectorTest.check(causes, "Should generate causes");
119 checkStringContains(causes, "Layout forcedlayoutFunction @ layoutFunction.js:");
120 checkStringContains(causes, "First layout invalidationlayoutFunction @ layoutFunction.js:");
121 next();
126 </script>
127 </head>
129 <body onload="runTest()">
131 Test that causes are correctly generated for various types of events.
132 </p>
133 <div id="testElement"></div>
134 </body>
135 </html>