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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js

Issue 1353653003: DevTools: cleanup timeline concise record details generation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-uploading after blink repo merge Created 5 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
OLDNEW
1 var initialize_Timeline = function() { 1 var initialize_Timeline = function() {
2 2
3 InspectorTest.preloadPanel("timeline"); 3 InspectorTest.preloadPanel("timeline");
4 WebInspector.TempFile = InspectorTest.TempFileMock; 4 WebInspector.TempFile = InspectorTest.TempFileMock;
5 5
6 // Scrub values when printing out these properties in the record or data field. 6 // Scrub values when printing out these properties in the record or data field.
7 InspectorTest.timelinePropertyFormatters = { 7 InspectorTest.timelinePropertyFormatters = {
8 children: "formatAsTypeName", 8 children: "formatAsTypeName",
9 endTime: "formatAsTypeName", 9 endTime: "formatAsTypeName",
10 requestId: "formatAsTypeName", 10 requestId: "formatAsTypeName",
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 { 138 {
139 var model = WebInspector.panels.timeline._model; 139 var model = WebInspector.panels.timeline._model;
140 model.reset(); 140 model.reset();
141 records.forEach(model._addRecord, model); 141 records.forEach(model._addRecord, model);
142 } 142 }
143 143
144 InspectorTest.performActionsAndPrint = function(actions, typeName, includeTimeSt amps) 144 InspectorTest.performActionsAndPrint = function(actions, typeName, includeTimeSt amps)
145 { 145 {
146 function callback() 146 function callback()
147 { 147 {
148 InspectorTest.printTimelineRecords(typeName); 148 InspectorTest.printTimelineRecordsWithDetails(typeName);
149 if (includeTimeStamps) { 149 if (includeTimeStamps) {
150 InspectorTest.addResult("Timestamp records: "); 150 InspectorTest.addResult("Timestamp records: ");
151 InspectorTest.printTimestampRecords(typeName); 151 InspectorTest.printTimestampRecords(typeName);
152 } 152 }
153 InspectorTest.completeTest(); 153 InspectorTest.completeTest();
154 } 154 }
155 InspectorTest.evaluateWithTimeline(actions, callback); 155 InspectorTest.evaluateWithTimeline(actions, callback);
156 }; 156 };
157 157
158 InspectorTest.printTimelineRecords = function(typeName, formatter) 158 InspectorTest.printTimelineRecords = function(typeName, formatter)
159 { 159 {
160 InspectorTest.timelineModel().forAllRecords(InspectorTest._printTimlineRecor d.bind(InspectorTest, typeName, formatter)); 160 InspectorTest.timelineModel().forAllRecords(InspectorTest._printTimlineRecor d.bind(InspectorTest, typeName, formatter));
161 }; 161 };
162 162
163 InspectorTest.detailsTextForTraceEvent = function(traceEvent)
164 {
165 return WebInspector.TimelineUIUtils.buildDetailsTextForTraceEvent(traceEvent ,
166 WebInspector.targetManager.mainTarget(),
167 new WebInspector.Linkifier());
168 }
169
170 InspectorTest.printTimelineRecordsWithDetails = function(typeName)
171 {
172 function detailsFormatter(recordType, record)
173 {
174 if (recordType && recordType !== record.type())
175 return;
176 InspectorTest.addResult("Text details for " + record.type() + ": " + Ins pectorTest.detailsTextForTraceEvent(record.traceEvent()));
177 }
178
179 InspectorTest.timelineModel().forAllRecords(InspectorTest._printTimlineRecor d.bind(InspectorTest, typeName, detailsFormatter.bind(null, typeName)));
180 };
181
163 InspectorTest.printTimelinePresentationRecords = function(typeName, formatter) 182 InspectorTest.printTimelinePresentationRecords = function(typeName, formatter)
164 { 183 {
165 InspectorTest.innerPrintTimelinePresentationRecords(WebInspector.panels.time line._model.records(), typeName, formatter); 184 InspectorTest.innerPrintTimelinePresentationRecords(WebInspector.panels.time line._model.records(), typeName, formatter);
166 }; 185 };
167 186
168 InspectorTest.printTimestampRecords = function(typeName, formatter) 187 InspectorTest.printTimestampRecords = function(typeName, formatter)
169 { 188 {
170 InspectorTest.innerPrintTimelineRecords(InspectorTest.timelineModel().eventD ividerRecords(), typeName, formatter); 189 InspectorTest.innerPrintTimelineRecords(InspectorTest.timelineModel().eventD ividerRecords(), typeName, formatter);
171 }; 190 };
172 191
173 InspectorTest.innerPrintTimelineRecords = function(records, typeName, formatter) 192 InspectorTest.innerPrintTimelineRecords = function(records, typeName, formatter)
174 { 193 {
175 for (var i = 0; i < records.length; ++i) 194 for (var i = 0; i < records.length; ++i)
176 InspectorTest._printTimlineRecord(typeName, formatter, records[i]); 195 InspectorTest._printTimlineRecord(typeName, formatter, records[i]);
177 }; 196 };
178 197
179 InspectorTest._printTimlineRecord = function(typeName, formatter, record) 198 InspectorTest._printTimlineRecord = function(typeName, formatter, record)
180 { 199 {
181 if (typeName && record.type() === typeName) 200 if (typeName && record.type() === typeName)
182 InspectorTest.printTimelineRecordProperties(record); 201 InspectorTest.printTimelineRecordProperties(record);
183 if (formatter) 202 if (formatter)
184 formatter(record); 203 formatter(record);
185 }; 204 };
186 205
187
188 InspectorTest.innerPrintTimelinePresentationRecords = function(records, typeName , formatter) 206 InspectorTest.innerPrintTimelinePresentationRecords = function(records, typeName , formatter)
189 { 207 {
190 for (var i = 0; i < records.length; ++i) { 208 for (var i = 0; i < records.length; ++i) {
191 if (typeName && records[i].type() === typeName) 209 if (typeName && records[i].type() === typeName)
192 InspectorTest.printTimelineRecordProperties(records[i]); 210 InspectorTest.printTimelineRecordProperties(records[i]);
193 if (formatter) 211 if (formatter)
194 formatter(records[i]); 212 formatter(records[i]);
195 InspectorTest.innerPrintTimelinePresentationRecords(records[i].children( ), typeName, formatter); 213 InspectorTest.innerPrintTimelinePresentationRecords(records[i].children( ), typeName, formatter);
196 } 214 }
197 }; 215 };
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (!--count) { 429 if (!--count) {
412 callback(); 430 callback();
413 return; 431 return;
414 } 432 }
415 if (window.testRunner) 433 if (window.testRunner)
416 testRunner.capturePixelsAsyncThen(requestAnimationFrame.bind(window, makeFrame)); 434 testRunner.capturePixelsAsyncThen(requestAnimationFrame.bind(window, makeFrame));
417 else 435 else
418 window.requestAnimationFrame(makeFrame); 436 window.requestAnimationFrame(makeFrame);
419 } 437 }
420 } 438 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698