OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../../http/tests/inspector/timeline-test.js"></script> | 4 <script src="../../../http/tests/inspector/timeline-test.js"></script> |
5 <script> | 5 <script> |
6 function test() | 6 function test() |
7 { | 7 { |
8 function checkStringContains(string, contains) | 8 function checkStringContains(string, contains) |
9 { | 9 { |
10 var doesContain = string.indexOf(contains) >= 0; | 10 var doesContain = string.indexOf(contains) >= 0; |
(...skipping 12 matching lines...) Expand all Loading... |
23 var source = setTimeoutFunction.toString(); | 23 var source = setTimeoutFunction.toString(); |
24 source += "\n//# sourceURL=setTimeoutFunction.js"; | 24 source += "\n//# sourceURL=setTimeoutFunction.js"; |
25 InspectorTest.evaluateInPage(source); | 25 InspectorTest.evaluateInPage(source); |
26 | 26 |
27 InspectorTest.invokeAsyncWithTimeline("setTimeoutFunction", finishAn
dRunNextTest); | 27 InspectorTest.invokeAsyncWithTimeline("setTimeoutFunction", finishAn
dRunNextTest); |
28 function finishAndRunNextTest() | 28 function finishAndRunNextTest() |
29 { | 29 { |
30 var linkifier = new WebInspector.Linkifier(); | 30 var linkifier = new WebInspector.Linkifier(); |
31 var record = InspectorTest.findFirstTimelineRecord("TimerFire"); | 31 var record = InspectorTest.findFirstTimelineRecord("TimerFire"); |
32 InspectorTest.check(record, "Should receive a TimerFire record."
); | 32 InspectorTest.check(record, "Should receive a TimerFire record."
); |
33 var contentHelper = new WebInspector.TimelineDetailsContentHelpe
r(InspectorTest.timelineModel().target(), linkifier, true); | 33 var event = record.traceEvent(); |
34 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent()
, InspectorTest.timelineModel().target(), null, contentHelper); | 34 var contentHelper = new WebInspector.TimelineDetailsContentHelpe
r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true); |
| 35 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes
t.timelineModel().targetByEvent(event), null, contentHelper); |
35 var causes = contentHelper.element.deepTextContent(); | 36 var causes = contentHelper.element.deepTextContent(); |
36 InspectorTest.check(causes, "Should generate causes"); | 37 InspectorTest.check(causes, "Should generate causes"); |
37 checkStringContains(causes, "Timer InstalledsetTimeoutFunction @
setTimeoutFunction.js:"); | 38 checkStringContains(causes, "Timer InstalledsetTimeoutFunction @
setTimeoutFunction.js:"); |
38 next(); | 39 next(); |
39 } | 40 } |
40 }, | 41 }, |
41 | 42 |
42 function testRequestAnimationFrame(next) | 43 function testRequestAnimationFrame(next) |
43 { | 44 { |
44 function requestAnimationFrameFunction(callback) | 45 function requestAnimationFrameFunction(callback) |
45 { | 46 { |
46 requestAnimationFrame(callback); | 47 requestAnimationFrame(callback); |
47 } | 48 } |
48 | 49 |
49 var source = requestAnimationFrameFunction.toString(); | 50 var source = requestAnimationFrameFunction.toString(); |
50 source += "\n//# sourceURL=requestAnimationFrameFunction.js"; | 51 source += "\n//# sourceURL=requestAnimationFrameFunction.js"; |
51 InspectorTest.evaluateInPage(source); | 52 InspectorTest.evaluateInPage(source); |
52 | 53 |
53 InspectorTest.invokeAsyncWithTimeline("requestAnimationFrameFunction
", finishAndRunNextTest); | 54 InspectorTest.invokeAsyncWithTimeline("requestAnimationFrameFunction
", finishAndRunNextTest); |
54 function finishAndRunNextTest() | 55 function finishAndRunNextTest() |
55 { | 56 { |
56 var linkifier = new WebInspector.Linkifier(); | 57 var linkifier = new WebInspector.Linkifier(); |
57 var record = InspectorTest.findFirstTimelineRecord("FireAnimatio
nFrame"); | 58 var record = InspectorTest.findFirstTimelineRecord("FireAnimatio
nFrame"); |
58 InspectorTest.check(record, "Should receive a FireAnimationFrame
record."); | 59 InspectorTest.check(record, "Should receive a FireAnimationFrame
record."); |
59 var contentHelper = new WebInspector.TimelineDetailsContentHelpe
r(InspectorTest.timelineModel().target(), linkifier, true); | 60 var event = record.traceEvent(); |
60 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent()
, InspectorTest.timelineModel().target(), null, contentHelper); | 61 var contentHelper = new WebInspector.TimelineDetailsContentHelpe
r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true); |
| 62 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes
t.timelineModel().targetByEvent(event), null, contentHelper); |
61 var causes = contentHelper.element.deepTextContent(); | 63 var causes = contentHelper.element.deepTextContent(); |
62 InspectorTest.check(causes, "Should generate causes"); | 64 InspectorTest.check(causes, "Should generate causes"); |
63 checkStringContains(causes, "Animation Frame RequestedrequestAni
mationFrameFunction @ requestAnimationFrameFunction.js:"); | 65 checkStringContains(causes, "Animation Frame RequestedrequestAni
mationFrameFunction @ requestAnimationFrameFunction.js:"); |
64 next(); | 66 next(); |
65 } | 67 } |
66 }, | 68 }, |
67 | 69 |
68 function testStyleRecalc(next) | 70 function testStyleRecalc(next) |
69 { | 71 { |
70 function styleRecalcFunction() | 72 function styleRecalcFunction() |
71 { | 73 { |
72 var element = document.getElementById("testElement"); | 74 var element = document.getElementById("testElement"); |
73 element.style.backgroundColor = "papayawhip"; | 75 element.style.backgroundColor = "papayawhip"; |
74 var forceLayout = element.offsetWidth; | 76 var forceLayout = element.offsetWidth; |
75 } | 77 } |
76 | 78 |
77 var source = styleRecalcFunction.toString(); | 79 var source = styleRecalcFunction.toString(); |
78 source += "\n//# sourceURL=styleRecalcFunction.js"; | 80 source += "\n//# sourceURL=styleRecalcFunction.js"; |
79 InspectorTest.evaluateInPage(source); | 81 InspectorTest.evaluateInPage(source); |
80 | 82 |
81 InspectorTest.evaluateWithTimeline("styleRecalcFunction()", finishAn
dRunNextTest); | 83 InspectorTest.evaluateWithTimeline("styleRecalcFunction()", finishAn
dRunNextTest); |
82 function finishAndRunNextTest() | 84 function finishAndRunNextTest() |
83 { | 85 { |
84 var linkifier = new WebInspector.Linkifier(); | 86 var linkifier = new WebInspector.Linkifier(); |
85 var record = InspectorTest.findFirstTimelineRecord("UpdateLayout
Tree"); | 87 var record = InspectorTest.findFirstTimelineRecord("UpdateLayout
Tree"); |
86 InspectorTest.check(record, "Should receive a UpdateLayoutTree r
ecord."); | 88 InspectorTest.check(record, "Should receive a UpdateLayoutTree r
ecord."); |
87 var contentHelper = new WebInspector.TimelineDetailsContentHelpe
r(InspectorTest.timelineModel().target(), linkifier, true); | 89 var event = record.traceEvent(); |
88 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent()
, InspectorTest.timelineModel().target(), null, contentHelper); | 90 var contentHelper = new WebInspector.TimelineDetailsContentHelpe
r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true); |
| 91 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes
t.timelineModel().targetByEvent(event), null, contentHelper); |
89 var causes = contentHelper.element.deepTextContent(); | 92 var causes = contentHelper.element.deepTextContent(); |
90 InspectorTest.check(causes, "Should generate causes"); | 93 InspectorTest.check(causes, "Should generate causes"); |
91 checkStringContains(causes, "First InvalidatedstyleRecalcFunctio
n @ styleRecalcFunction.js:"); | 94 checkStringContains(causes, "First InvalidatedstyleRecalcFunctio
n @ styleRecalcFunction.js:"); |
92 next(); | 95 next(); |
93 } | 96 } |
94 }, | 97 }, |
95 | 98 |
96 function testLayout(next) | 99 function testLayout(next) |
97 { | 100 { |
98 function layoutFunction() | 101 function layoutFunction() |
99 { | 102 { |
100 var element = document.getElementById("testElement"); | 103 var element = document.getElementById("testElement"); |
101 element.style.width = "200px"; | 104 element.style.width = "200px"; |
102 var forceLayout = element.offsetWidth; | 105 var forceLayout = element.offsetWidth; |
103 } | 106 } |
104 | 107 |
105 var source = layoutFunction.toString(); | 108 var source = layoutFunction.toString(); |
106 source += "\n//# sourceURL=layoutFunction.js"; | 109 source += "\n//# sourceURL=layoutFunction.js"; |
107 InspectorTest.evaluateInPage(source); | 110 InspectorTest.evaluateInPage(source); |
108 | 111 |
109 InspectorTest.evaluateWithTimeline("layoutFunction()", finishAndRunN
extTest); | 112 InspectorTest.evaluateWithTimeline("layoutFunction()", finishAndRunN
extTest); |
110 function finishAndRunNextTest() | 113 function finishAndRunNextTest() |
111 { | 114 { |
112 var linkifier = new WebInspector.Linkifier(); | 115 var linkifier = new WebInspector.Linkifier(); |
113 var record = InspectorTest.findFirstTimelineRecord("Layout"); | 116 var record = InspectorTest.findFirstTimelineRecord("Layout"); |
114 InspectorTest.check(record, "Should receive a Layout record."); | 117 InspectorTest.check(record, "Should receive a Layout record."); |
115 var contentHelper = new WebInspector.TimelineDetailsContentHelpe
r(InspectorTest.timelineModel().target(), linkifier, true); | 118 var event = record.traceEvent(); |
116 WebInspector.TimelineUIUtils._generateCauses(record.traceEvent()
, InspectorTest.timelineModel().target(), null, contentHelper); | 119 var contentHelper = new WebInspector.TimelineDetailsContentHelpe
r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true); |
| 120 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes
t.timelineModel().targetByEvent(event), null, contentHelper); |
117 var causes = contentHelper.element.deepTextContent(); | 121 var causes = contentHelper.element.deepTextContent(); |
118 InspectorTest.check(causes, "Should generate causes"); | 122 InspectorTest.check(causes, "Should generate causes"); |
119 checkStringContains(causes, "Layout ForcedlayoutFunction @ layou
tFunction.js:"); | 123 checkStringContains(causes, "Layout ForcedlayoutFunction @ layou
tFunction.js:"); |
120 checkStringContains(causes, "First Layout InvalidationlayoutFunc
tion @ layoutFunction.js:"); | 124 checkStringContains(causes, "First Layout InvalidationlayoutFunc
tion @ layoutFunction.js:"); |
121 next(); | 125 next(); |
122 } | 126 } |
123 } | 127 } |
124 ]); | 128 ]); |
125 } | 129 } |
126 </script> | 130 </script> |
127 </head> | 131 </head> |
128 | 132 |
129 <body onload="runTest()"> | 133 <body onload="runTest()"> |
130 <p> | 134 <p> |
131 Test that causes are correctly generated for various types of events. | 135 Test that causes are correctly generated for various types of events. |
132 </p> | 136 </p> |
133 <div id="testElement"></div> | 137 <div id="testElement"></div> |
134 </body> | 138 </body> |
135 </html> | 139 </html> |
OLD | NEW |