OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../http/tests/inspector/console-test.js"></script> | |
5 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
6 <script> | |
7 | |
8 function startStopTimeline() | |
9 { | |
10 console.timeStamp("timestamp 0"); | |
11 console.timeline("one"); | |
12 console.timeStamp("timestamp 1"); | |
13 console.timelineEnd("one"); | |
14 console.timeStamp("timestamp 2"); | |
15 } | |
16 | |
17 function startStopMultiple() | |
18 { | |
19 console.timeStamp("timestamp 0"); | |
20 console.timeline("one"); | |
21 console.timeStamp("timestamp 1"); | |
22 console.timeline("one"); | |
23 console.timeline("two"); | |
24 console.timeline("two"); | |
25 console.timelineEnd("two"); | |
26 console.timeStamp("timestamp 2"); | |
27 console.timelineEnd("one"); | |
28 console.timeStamp("timestamp 3"); | |
29 console.timelineEnd("two"); | |
30 console.timeStamp("timestamp 4"); | |
31 console.timelineEnd("one"); | |
32 console.timeStamp("timestamp 5"); | |
33 } | |
34 | |
35 function startMultiple() | |
36 { | |
37 console.timeStamp("timestamp 0"); | |
38 console.timeline("one"); | |
39 console.timeStamp("timestamp 1"); | |
40 console.timeline("two"); | |
41 console.timeStamp("timestamp 2"); | |
42 } | |
43 | |
44 function stopTwo() | |
45 { | |
46 console.timeStamp("timestamp 3"); | |
47 console.timelineEnd("two"); | |
48 console.timeStamp("timestamp 4"); | |
49 } | |
50 | |
51 function stopOne() | |
52 { | |
53 console.timeStamp("timestamp 5"); | |
54 console.timelineEnd("one"); | |
55 console.timeStamp("timestamp 6 - FAIL"); | |
56 } | |
57 | |
58 function stopUnknown() | |
59 { | |
60 console.timeStamp("timestamp 0"); | |
61 console.timeline("one"); | |
62 console.timeStamp("timestamp 1"); | |
63 console.timelineEnd("two"); | |
64 console.timeStamp("timestamp 2"); | |
65 console.timelineEnd("one"); | |
66 console.timeStamp("timestamp 3"); | |
67 } | |
68 | |
69 function startTimeline() | |
70 { | |
71 console.timeStamp("timestamp 0"); | |
72 console.timeline("one"); | |
73 console.timeStamp("timestamp 1"); | |
74 console.timeline("two"); | |
75 console.timeStamp("timestamp 2"); | |
76 } | |
77 | |
78 function test() | |
79 { | |
80 var panel = WebInspector.panels.timeline; | |
81 panel._model._currentTarget = WebInspector.targetManager.mainTarget(); | |
82 | |
83 InspectorTest.runTestSuite([ | |
84 function testStartStopTimeline(next) | |
85 { | |
86 InspectorTest.evaluateWithTimeline("startStopTimeline()", allEventsR
eceived); | |
87 | |
88 function allEventsReceived() | |
89 { | |
90 printTimelineAndTimestampEvents(); | |
91 next(); | |
92 } | |
93 }, | |
94 | |
95 function testStartStopMultiple(next) | |
96 { | |
97 InspectorTest.evaluateWithTimeline("startStopMultiple()", allEventsR
eceived); | |
98 | |
99 function allEventsReceived() | |
100 { | |
101 printTimelineAndTimestampEvents(); | |
102 next(); | |
103 } | |
104 }, | |
105 | |
106 function testStartMultipleStopInsideEvals(next) | |
107 { | |
108 InspectorTest.startTimeline(step1); | |
109 | |
110 function step1() | |
111 { | |
112 InspectorTest.evaluateInPage("startMultiple()", step2); | |
113 } | |
114 | |
115 function step2() | |
116 { | |
117 InspectorTest.evaluateInPage("stopTwo()", step3); | |
118 } | |
119 | |
120 function step3() | |
121 { | |
122 InspectorTest.evaluateInPage("stopOne()", step4); | |
123 } | |
124 | |
125 function step4() | |
126 { | |
127 InspectorTest.stopTimeline(finish); | |
128 } | |
129 | |
130 function finish() | |
131 { | |
132 printTimelineAndTimestampEvents(); | |
133 next(); | |
134 } | |
135 }, | |
136 | |
137 function testStopUnknown(next) | |
138 { | |
139 InspectorTest.evaluateWithTimeline("stopUnknown()", allEventsReceive
d); | |
140 | |
141 function allEventsReceived() | |
142 { | |
143 printTimelineAndTimestampEvents(); | |
144 next(); | |
145 } | |
146 }, | |
147 | |
148 function testStartFromPanel(next) | |
149 { | |
150 InspectorTest.evaluateWithTimeline("startStopTimeline()", finish) | |
151 | |
152 function finish() | |
153 { | |
154 printTimelineAndTimestampEvents(); | |
155 next(); | |
156 } | |
157 }, | |
158 | |
159 function testStopFromPanel(next) | |
160 { | |
161 InspectorTest.evaluateWithTimeline("startTimeline()", finish) | |
162 | |
163 function finish() | |
164 { | |
165 printTimelineAndTimestampEvents(); | |
166 next(); | |
167 } | |
168 } | |
169 ]); | |
170 | |
171 function printTimelineAndTimestampEvents() { | |
172 panel._tracingModel.sortedProcesses().forEach(function(process) | |
173 { | |
174 process.sortedThreads().forEach(function(thread) | |
175 { | |
176 thread.events().forEach(function(event) | |
177 { | |
178 if (event.hasCategory(WebInspector.TimelineModel.Category.Con
sole)) | |
179 InspectorTest.addResult(event.name); | |
180 else if (event.name === WebInspector.TimelineModel.RecordType
.TimeStamp) | |
181 InspectorTest.addResult(event.args["data"]["message"]); | |
182 }); | |
183 }); | |
184 }); | |
185 } | |
186 } | |
187 | |
188 </script> | |
189 </head> | |
190 | |
191 <body onload="runTest()"> | |
192 <p> | |
193 Tests console.timeline and timelineEnd commands. | |
194 </p> | |
195 | |
196 </body> | |
197 </html> | |
OLD | NEW |