| OLD | NEW |
| 1 function wrapCallFunctionForTimeline(f) | 1 function wrapCallFunctionForTimeline(f) |
| 2 { | 2 { |
| 3 var script = document.createElement("script"); | 3 var script = document.createElement("script"); |
| 4 script.textContent = "(" + f.toString() + ")()\n//# sourceURL=wrapCallFuncti
onForTimeline.js"; | 4 script.textContent = "(" + f.toString() + ")()\n//# sourceURL=wrapCallFuncti
onForTimeline.js"; |
| 5 document.body.appendChild(script); | 5 document.body.appendChild(script); |
| 6 } | 6 } |
| 7 | 7 |
| 8 var initialize_Timeline = function() { | 8 var initialize_Timeline = function() { |
| 9 | 9 |
| 10 InspectorTest.preloadPanel("timeline"); | 10 InspectorTest.preloadPanel("timeline"); |
| 11 WebInspector.TempFile = InspectorTest.TempFileMock; | 11 Bindings.TempFile = InspectorTest.TempFileMock; |
| 12 | 12 |
| 13 // Scrub values when printing out these properties in the record or data field. | 13 // Scrub values when printing out these properties in the record or data field. |
| 14 InspectorTest.timelinePropertyFormatters = { | 14 InspectorTest.timelinePropertyFormatters = { |
| 15 children: "formatAsTypeName", | 15 children: "formatAsTypeName", |
| 16 endTime: "formatAsTypeName", | 16 endTime: "formatAsTypeName", |
| 17 requestId: "formatAsTypeName", | 17 requestId: "formatAsTypeName", |
| 18 startTime: "formatAsTypeName", | 18 startTime: "formatAsTypeName", |
| 19 stackTrace: "formatAsTypeName", | 19 stackTrace: "formatAsTypeName", |
| 20 url: "formatAsURL", | 20 url: "formatAsURL", |
| 21 scriptName: "formatAsTypeName", | 21 scriptName: "formatAsTypeName", |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 { | 62 { |
| 63 if (!cause) | 63 if (!cause) |
| 64 return "<undefined>"; | 64 return "<undefined>"; |
| 65 var stackTrace; | 65 var stackTrace; |
| 66 if (cause.stackTrace && cause.stackTrace.length) | 66 if (cause.stackTrace && cause.stackTrace.length) |
| 67 stackTrace = InspectorTest.formatters.formatAsURL(cause.stackTrace[0].ur
l) + ":" + (cause.stackTrace[0].lineNumber + 1); | 67 stackTrace = InspectorTest.formatters.formatAsURL(cause.stackTrace[0].ur
l) + ":" + (cause.stackTrace[0].lineNumber + 1); |
| 68 return "{reason: " + cause.reason + ", stackTrace: " + stackTrace + "}"; | 68 return "{reason: " + cause.reason + ", stackTrace: " + stackTrace + "}"; |
| 69 } | 69 } |
| 70 | 70 |
| 71 InspectorTest.preloadPanel("timeline"); | 71 InspectorTest.preloadPanel("timeline"); |
| 72 WebInspector.TempFile = InspectorTest.TempFileMock; | 72 Bindings.TempFile = InspectorTest.TempFileMock; |
| 73 | 73 |
| 74 InspectorTest.createTracingModel = function() | 74 InspectorTest.createTracingModel = function() |
| 75 { | 75 { |
| 76 return new WebInspector.TracingModel(new WebInspector.TempFileBackingStorage
("tracing")); | 76 return new SDK.TracingModel(new Bindings.TempFileBackingStorage("tracing")); |
| 77 } | 77 } |
| 78 | 78 |
| 79 InspectorTest.tracingModel = function() | 79 InspectorTest.tracingModel = function() |
| 80 { | 80 { |
| 81 return WebInspector.panels.timeline._tracingModel; | 81 return UI.panels.timeline._tracingModel; |
| 82 } | 82 } |
| 83 | 83 |
| 84 InspectorTest.invokeWithTracing = function(functionName, callback, additionalCat
egories, enableJSSampling) | 84 InspectorTest.invokeWithTracing = function(functionName, callback, additionalCat
egories, enableJSSampling) |
| 85 { | 85 { |
| 86 var categories = "-*,disabled-by-default-devtools.timeline*,devtools.timelin
e," + WebInspector.TracingModel.TopLevelEventCategory; | 86 var categories = "-*,disabled-by-default-devtools.timeline*,devtools.timelin
e," + SDK.TracingModel.TopLevelEventCategory; |
| 87 if (additionalCategories) | 87 if (additionalCategories) |
| 88 categories += "," + additionalCategories; | 88 categories += "," + additionalCategories; |
| 89 var timelinePanel = WebInspector.panels.timeline; | 89 var timelinePanel = UI.panels.timeline; |
| 90 var timelineController = InspectorTest.timelineController(); | 90 var timelineController = InspectorTest.timelineController(); |
| 91 timelinePanel._timelineController = timelineController; | 91 timelinePanel._timelineController = timelineController; |
| 92 timelineController._startRecordingWithCategories(categories, enableJSSamplin
g, tracingStarted); | 92 timelineController._startRecordingWithCategories(categories, enableJSSamplin
g, tracingStarted); |
| 93 | 93 |
| 94 function tracingStarted() | 94 function tracingStarted() |
| 95 { | 95 { |
| 96 InspectorTest.callFunctionInPageAsync(functionName).then(onPageActionsDo
ne); | 96 InspectorTest.callFunctionInPageAsync(functionName).then(onPageActionsDo
ne); |
| 97 } | 97 } |
| 98 | 98 |
| 99 function onPageActionsDone() | 99 function onPageActionsDone() |
| 100 { | 100 { |
| 101 InspectorTest.addSniffer(WebInspector.panels.timeline, "loadingComplete"
, callback) | 101 InspectorTest.addSniffer(UI.panels.timeline, "loadingComplete", callback
) |
| 102 timelineController.stopRecording(); | 102 timelineController.stopRecording(); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 InspectorTest.timelineModel = function() | 106 InspectorTest.timelineModel = function() |
| 107 { | 107 { |
| 108 return WebInspector.panels.timeline._model; | 108 return UI.panels.timeline._model; |
| 109 } | 109 } |
| 110 | 110 |
| 111 InspectorTest.timelineFrameModel = function() | 111 InspectorTest.timelineFrameModel = function() |
| 112 { | 112 { |
| 113 return WebInspector.panels.timeline._frameModel; | 113 return UI.panels.timeline._frameModel; |
| 114 } | 114 } |
| 115 | 115 |
| 116 InspectorTest.setTraceEvents = function(timelineModel, tracingModel, events) | 116 InspectorTest.setTraceEvents = function(timelineModel, tracingModel, events) |
| 117 { | 117 { |
| 118 tracingModel.reset(); | 118 tracingModel.reset(); |
| 119 tracingModel.addEvents(events); | 119 tracingModel.addEvents(events); |
| 120 tracingModel.tracingComplete(); | 120 tracingModel.tracingComplete(); |
| 121 timelineModel.setEvents(tracingModel); | 121 timelineModel.setEvents(tracingModel); |
| 122 } | 122 } |
| 123 | 123 |
| 124 InspectorTest.createTimelineModelWithEvents = function(events) | 124 InspectorTest.createTimelineModelWithEvents = function(events) |
| 125 { | 125 { |
| 126 var tracingModel = new WebInspector.TracingModel(new WebInspector.TempFileBa
ckingStorage("tracing")); | 126 var tracingModel = new SDK.TracingModel(new Bindings.TempFileBackingStorage(
"tracing")); |
| 127 var timelineModel = new WebInspector.TimelineModel(WebInspector.TimelineUIUt
ils.visibleEventsFilter()); | 127 var timelineModel = new TimelineModel.TimelineModel(Timeline.TimelineUIUtils
.visibleEventsFilter()); |
| 128 InspectorTest.setTraceEvents(timelineModel, tracingModel, events); | 128 InspectorTest.setTraceEvents(timelineModel, tracingModel, events); |
| 129 return timelineModel; | 129 return timelineModel; |
| 130 } | 130 } |
| 131 | 131 |
| 132 InspectorTest.timelineController = function() | 132 InspectorTest.timelineController = function() |
| 133 { | 133 { |
| 134 var mainTarget = WebInspector.targetManager.mainTarget(); | 134 var mainTarget = SDK.targetManager.mainTarget(); |
| 135 var timelinePanel = WebInspector.panels.timeline; | 135 var timelinePanel = UI.panels.timeline; |
| 136 return new WebInspector.TimelineController(mainTarget, timelinePanel, timeli
nePanel._tracingModel); | 136 return new Timeline.TimelineController(mainTarget, timelinePanel, timelinePa
nel._tracingModel); |
| 137 } | 137 } |
| 138 | 138 |
| 139 InspectorTest.startTimeline = function(callback) | 139 InspectorTest.startTimeline = function(callback) |
| 140 { | 140 { |
| 141 var panel = WebInspector.panels.timeline; | 141 var panel = UI.panels.timeline; |
| 142 InspectorTest.addSniffer(panel, "recordingStarted", callback); | 142 InspectorTest.addSniffer(panel, "recordingStarted", callback); |
| 143 panel._toggleRecording(); | 143 panel._toggleRecording(); |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 InspectorTest.stopTimeline = function(callback) | 146 InspectorTest.stopTimeline = function(callback) |
| 147 { | 147 { |
| 148 var panel = WebInspector.panels.timeline; | 148 var panel = UI.panels.timeline; |
| 149 function didStop() | 149 function didStop() |
| 150 { | 150 { |
| 151 InspectorTest.deprecatedRunAfterPendingDispatches(callback); | 151 InspectorTest.deprecatedRunAfterPendingDispatches(callback); |
| 152 } | 152 } |
| 153 InspectorTest.addSniffer(panel, "loadingComplete", didStop); | 153 InspectorTest.addSniffer(panel, "loadingComplete", didStop); |
| 154 panel._toggleRecording(); | 154 panel._toggleRecording(); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 InspectorTest.evaluateWithTimeline = function(actions, doneCallback) | 157 InspectorTest.evaluateWithTimeline = function(actions, doneCallback) |
| 158 { | 158 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 177 } | 177 } |
| 178 | 178 |
| 179 function step2() | 179 function step2() |
| 180 { | 180 { |
| 181 InspectorTest.stopTimeline(InspectorTest.safeWrap(doneCallback)); | 181 InspectorTest.stopTimeline(InspectorTest.safeWrap(doneCallback)); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 InspectorTest.loadTimelineRecords = function(records) | 185 InspectorTest.loadTimelineRecords = function(records) |
| 186 { | 186 { |
| 187 var model = WebInspector.panels.timeline._model; | 187 var model = UI.panels.timeline._model; |
| 188 model.reset(); | 188 model.reset(); |
| 189 records.forEach(model._addRecord, model); | 189 records.forEach(model._addRecord, model); |
| 190 } | 190 } |
| 191 | 191 |
| 192 InspectorTest.performActionsAndPrint = function(actions, typeName, includeTimeSt
amps) | 192 InspectorTest.performActionsAndPrint = function(actions, typeName, includeTimeSt
amps) |
| 193 { | 193 { |
| 194 function callback() | 194 function callback() |
| 195 { | 195 { |
| 196 InspectorTest.printTimelineRecordsWithDetails(typeName); | 196 InspectorTest.printTimelineRecordsWithDetails(typeName); |
| 197 if (includeTimeStamps) { | 197 if (includeTimeStamps) { |
| 198 InspectorTest.addResult("Timestamp records: "); | 198 InspectorTest.addResult("Timestamp records: "); |
| 199 InspectorTest.printTimestampRecords(typeName); | 199 InspectorTest.printTimestampRecords(typeName); |
| 200 } | 200 } |
| 201 InspectorTest.completeTest(); | 201 InspectorTest.completeTest(); |
| 202 } | 202 } |
| 203 InspectorTest.evaluateWithTimeline(actions, callback); | 203 InspectorTest.evaluateWithTimeline(actions, callback); |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 InspectorTest.printTimelineRecords = function(typeName, formatter) | 206 InspectorTest.printTimelineRecords = function(typeName, formatter) |
| 207 { | 207 { |
| 208 InspectorTest.timelineModel().forAllRecords(InspectorTest._printTimlineRecor
d.bind(InspectorTest, typeName, formatter)); | 208 InspectorTest.timelineModel().forAllRecords(InspectorTest._printTimlineRecor
d.bind(InspectorTest, typeName, formatter)); |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 InspectorTest.detailsTextForTraceEvent = function(traceEvent) | 211 InspectorTest.detailsTextForTraceEvent = function(traceEvent) |
| 212 { | 212 { |
| 213 return WebInspector.TimelineUIUtils.buildDetailsTextForTraceEvent(traceEvent
, | 213 return Timeline.TimelineUIUtils.buildDetailsTextForTraceEvent(traceEvent, |
| 214 WebInspector.targetManager.mainTarget(), | 214 SDK.targetManager.mainTarget(), |
| 215 new WebInspector.Linkifier()); | 215 new Components.Linkifier()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 InspectorTest.printTimelineRecordsWithDetails = function(typeName) | 218 InspectorTest.printTimelineRecordsWithDetails = function(typeName) |
| 219 { | 219 { |
| 220 function detailsFormatter(recordType, record) | 220 function detailsFormatter(recordType, record) |
| 221 { | 221 { |
| 222 if (recordType && recordType !== record.type()) | 222 if (recordType && recordType !== record.type()) |
| 223 return; | 223 return; |
| 224 var event = record.traceEvent(); | 224 var event = record.traceEvent(); |
| 225 InspectorTest.addResult("Text details for " + record.type() + ": " + Ins
pectorTest.detailsTextForTraceEvent(event)); | 225 InspectorTest.addResult("Text details for " + record.type() + ": " + Ins
pectorTest.detailsTextForTraceEvent(event)); |
| 226 if (WebInspector.TimelineData.forEvent(event).warning) | 226 if (TimelineModel.TimelineData.forEvent(event).warning) |
| 227 InspectorTest.addResult(record.type() + " has a warning"); | 227 InspectorTest.addResult(record.type() + " has a warning"); |
| 228 } | 228 } |
| 229 | 229 |
| 230 InspectorTest.timelineModel().forAllRecords(InspectorTest._printTimlineRecor
d.bind(InspectorTest, typeName, detailsFormatter.bind(null, typeName))); | 230 InspectorTest.timelineModel().forAllRecords(InspectorTest._printTimlineRecor
d.bind(InspectorTest, typeName, detailsFormatter.bind(null, typeName))); |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 InspectorTest.walkTimelineEventTree = function(callback) | 233 InspectorTest.walkTimelineEventTree = function(callback) |
| 234 { | 234 { |
| 235 var model = InspectorTest.timelineModel(); | 235 var model = InspectorTest.timelineModel(); |
| 236 var view = new WebInspector.EventsTimelineTreeView(model, WebInspector.panel
s.timeline._filters, null); | 236 var view = new Timeline.EventsTimelineTreeView(model, UI.panels.timeline._fi
lters, null); |
| 237 var selection = WebInspector.TimelineSelection.fromRange(model.minimumRecord
Time(), model.maximumRecordTime()); | 237 var selection = Timeline.TimelineSelection.fromRange(model.minimumRecordTime
(), model.maximumRecordTime()); |
| 238 view.updateContents(selection); | 238 view.updateContents(selection); |
| 239 InspectorTest.walkTimelineEventTreeUnderNode(callback, view._currentTree, 0)
; | 239 InspectorTest.walkTimelineEventTreeUnderNode(callback, view._currentTree, 0)
; |
| 240 } | 240 } |
| 241 | 241 |
| 242 InspectorTest.walkTimelineEventTreeUnderNode = function(callback, root, level) | 242 InspectorTest.walkTimelineEventTreeUnderNode = function(callback, root, level) |
| 243 { | 243 { |
| 244 var event = root.event; | 244 var event = root.event; |
| 245 if (event) | 245 if (event) |
| 246 callback(event, level) | 246 callback(event, level) |
| 247 var children = root.children ? root.children.values() : []; | 247 var children = root.children ? root.children.values() : []; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 271 // Dump just the record name, indenting output on separate lines for subrecords | 271 // Dump just the record name, indenting output on separate lines for subrecords |
| 272 InspectorTest.dumpTimelineRecord = function(record, detailsCallback, level, filt
erTypes) | 272 InspectorTest.dumpTimelineRecord = function(record, detailsCallback, level, filt
erTypes) |
| 273 { | 273 { |
| 274 if (typeof level !== "number") | 274 if (typeof level !== "number") |
| 275 level = 0; | 275 level = 0; |
| 276 var message = ""; | 276 var message = ""; |
| 277 for (var i = 0; i < level ; ++i) | 277 for (var i = 0; i < level ; ++i) |
| 278 message = "----" + message; | 278 message = "----" + message; |
| 279 if (level > 0) | 279 if (level > 0) |
| 280 message = message + "> "; | 280 message = message + "> "; |
| 281 if (record.type() === WebInspector.TimelineModel.RecordType.TimeStamp | 281 if (record.type() === TimelineModel.TimelineModel.RecordType.TimeStamp |
| 282 || record.type() === WebInspector.TimelineModel.RecordType.ConsoleTime)
{ | 282 || record.type() === TimelineModel.TimelineModel.RecordType.ConsoleTime)
{ |
| 283 message += WebInspector.TimelineUIUtils.eventTitle(record.traceEvent()); | 283 message += Timeline.TimelineUIUtils.eventTitle(record.traceEvent()); |
| 284 } else { | 284 } else { |
| 285 message += record.type(); | 285 message += record.type(); |
| 286 } | 286 } |
| 287 if (detailsCallback) | 287 if (detailsCallback) |
| 288 message += " " + detailsCallback(record); | 288 message += " " + detailsCallback(record); |
| 289 InspectorTest.addResult(message); | 289 InspectorTest.addResult(message); |
| 290 | 290 |
| 291 var children = record.children(); | 291 var children = record.children(); |
| 292 var numChildren = children.length; | 292 var numChildren = children.length; |
| 293 for (var i = 0; i < numChildren; ++i) { | 293 for (var i = 0; i < numChildren; ++i) { |
| 294 if (filterTypes && filterTypes.indexOf(children[i].type()) == -1) | 294 if (filterTypes && filterTypes.indexOf(children[i].type()) == -1) |
| 295 continue; | 295 continue; |
| 296 InspectorTest.dumpTimelineRecord(children[i], detailsCallback, level + 1
, filterTypes); | 296 InspectorTest.dumpTimelineRecord(children[i], detailsCallback, level + 1
, filterTypes); |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 | 299 |
| 300 InspectorTest.dumpTimelineModelRecord = function(record, level) | 300 InspectorTest.dumpTimelineModelRecord = function(record, level) |
| 301 { | 301 { |
| 302 if (typeof level !== "number") | 302 if (typeof level !== "number") |
| 303 level = 0; | 303 level = 0; |
| 304 var prefix = ""; | 304 var prefix = ""; |
| 305 for (var i = 0; i < level ; ++i) | 305 for (var i = 0; i < level ; ++i) |
| 306 prefix = "----" + prefix; | 306 prefix = "----" + prefix; |
| 307 if (level > 0) | 307 if (level > 0) |
| 308 prefix = prefix + "> "; | 308 prefix = prefix + "> "; |
| 309 InspectorTest.addResult(prefix + record.type() + ": " + (WebInspector.Timeli
neUIUtils.buildDetailsTextForTraceEvent(record.traceEvent(), null) || "")); | 309 InspectorTest.addResult(prefix + record.type() + ": " + (Timeline.TimelineUI
Utils.buildDetailsTextForTraceEvent(record.traceEvent(), null) || "")); |
| 310 | 310 |
| 311 var numChildren = record.children() ? record.children().length : 0; | 311 var numChildren = record.children() ? record.children().length : 0; |
| 312 for (var i = 0; i < numChildren; ++i) | 312 for (var i = 0; i < numChildren; ++i) |
| 313 InspectorTest.dumpTimelineModelRecord(record.children()[i], level + 1); | 313 InspectorTest.dumpTimelineModelRecord(record.children()[i], level + 1); |
| 314 } | 314 } |
| 315 | 315 |
| 316 InspectorTest.dumpTimelineRecords = function(timelineRecords) | 316 InspectorTest.dumpTimelineRecords = function(timelineRecords) |
| 317 { | 317 { |
| 318 for (var i = 0; i < timelineRecords.length; ++i) | 318 for (var i = 0; i < timelineRecords.length; ++i) |
| 319 InspectorTest.dumpTimelineRecord(timelineRecords[i], 0); | 319 InspectorTest.dumpTimelineRecord(timelineRecords[i], 0); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 332 | 332 |
| 333 InspectorTest.printTraceEventProperties = function(traceEvent) | 333 InspectorTest.printTraceEventProperties = function(traceEvent) |
| 334 { | 334 { |
| 335 InspectorTest.addResult(traceEvent.name + " Properties:"); | 335 InspectorTest.addResult(traceEvent.name + " Properties:"); |
| 336 var data = traceEvent.args["beginData"] || traceEvent.args["data"]; | 336 var data = traceEvent.args["beginData"] || traceEvent.args["data"]; |
| 337 var frameId = data && data["frame"]; | 337 var frameId = data && data["frame"]; |
| 338 var object = { | 338 var object = { |
| 339 data: traceEvent.args["data"] || traceEvent.args, | 339 data: traceEvent.args["data"] || traceEvent.args, |
| 340 endTime: traceEvent.endTime || traceEvent.startTime, | 340 endTime: traceEvent.endTime || traceEvent.startTime, |
| 341 frameId: frameId, | 341 frameId: frameId, |
| 342 stackTrace: WebInspector.TimelineData.forEvent(traceEvent).stackTrace, | 342 stackTrace: TimelineModel.TimelineData.forEvent(traceEvent).stackTrace, |
| 343 startTime: traceEvent.startTime, | 343 startTime: traceEvent.startTime, |
| 344 type: traceEvent.name, | 344 type: traceEvent.name, |
| 345 }; | 345 }; |
| 346 for (var field in object) { | 346 for (var field in object) { |
| 347 if (object[field] === null || object[field] === undefined) | 347 if (object[field] === null || object[field] === undefined) |
| 348 delete object[field]; | 348 delete object[field]; |
| 349 } | 349 } |
| 350 InspectorTest.addObject(object, InspectorTest.timelinePropertyFormatters); | 350 InspectorTest.addObject(object, InspectorTest.timelinePropertyFormatters); |
| 351 }; | 351 }; |
| 352 | 352 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 result[key] = value; | 400 result[key] = value; |
| 401 } | 401 } |
| 402 return result; | 402 return result; |
| 403 } | 403 } |
| 404 InspectorTest.addObject(formatFields(frame)); | 404 InspectorTest.addObject(formatFields(frame)); |
| 405 } | 405 } |
| 406 | 406 |
| 407 InspectorTest.dumpInvalidations = function(recordType, index, comment) | 407 InspectorTest.dumpInvalidations = function(recordType, index, comment) |
| 408 { | 408 { |
| 409 var record = InspectorTest.findTimelineRecord(recordType, index || 0); | 409 var record = InspectorTest.findTimelineRecord(recordType, index || 0); |
| 410 InspectorTest.addArray(WebInspector.InvalidationTracker.invalidationEventsFo
r(record._event), InspectorTest.InvalidationFormatters, "", comment); | 410 InspectorTest.addArray(TimelineModel.InvalidationTracker.invalidationEventsF
or(record._event), InspectorTest.InvalidationFormatters, "", comment); |
| 411 } | 411 } |
| 412 | 412 |
| 413 InspectorTest.FakeFileReader.prototype = { | 413 InspectorTest.FakeFileReader.prototype = { |
| 414 start: function(output) | 414 start: function(output) |
| 415 { | 415 { |
| 416 this._delegate.onTransferStarted(this); | 416 this._delegate.onTransferStarted(this); |
| 417 | 417 |
| 418 var length = this._input.length; | 418 var length = this._input.length; |
| 419 var half = (length + 1) >> 1; | 419 var half = (length + 1) >> 1; |
| 420 | 420 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 447 }, | 447 }, |
| 448 | 448 |
| 449 fileName: function() | 449 fileName: function() |
| 450 { | 450 { |
| 451 return "fakeFile"; | 451 return "fakeFile"; |
| 452 } | 452 } |
| 453 }; | 453 }; |
| 454 | 454 |
| 455 InspectorTest.loadTimeline = function(timelineData) | 455 InspectorTest.loadTimeline = function(timelineData) |
| 456 { | 456 { |
| 457 var timeline = WebInspector.panels.timeline; | 457 var timeline = UI.panels.timeline; |
| 458 | 458 |
| 459 function createFileReader(file, delegate) | 459 function createFileReader(file, delegate) |
| 460 { | 460 { |
| 461 return new InspectorTest.FakeFileReader(timelineData, delegate, timeline
._saveToFile.bind(timeline)); | 461 return new InspectorTest.FakeFileReader(timelineData, delegate, timeline
._saveToFile.bind(timeline)); |
| 462 } | 462 } |
| 463 | 463 |
| 464 InspectorTest.override(WebInspector.TimelineLoader, "_createFileReader", cre
ateFileReader); | 464 InspectorTest.override(Timeline.TimelineLoader, "_createFileReader", createF
ileReader); |
| 465 timeline._loadFromFile({}); | 465 timeline._loadFromFile({}); |
| 466 } | 466 } |
| 467 | 467 |
| 468 }; | 468 }; |
| 469 | 469 |
| 470 function generateFrames(count) | 470 function generateFrames(count) |
| 471 { | 471 { |
| 472 var promise = Promise.resolve(); | 472 var promise = Promise.resolve(); |
| 473 for (let i = count; i > 0; --i) | 473 for (let i = count; i > 0; --i) |
| 474 promise = promise.then(changeBackgroundAndWaitForFrame.bind(null, i)); | 474 promise = promise.then(changeBackgroundAndWaitForFrame.bind(null, i)); |
| 475 return promise; | 475 return promise; |
| 476 | 476 |
| 477 function changeBackgroundAndWaitForFrame(i) | 477 function changeBackgroundAndWaitForFrame(i) |
| 478 { | 478 { |
| 479 document.body.style.backgroundColor = i & 1 ? "rgb(200, 200, 200)" : "rg
b(240, 240, 240)"; | 479 document.body.style.backgroundColor = i & 1 ? "rgb(200, 200, 200)" : "rg
b(240, 240, 240)"; |
| 480 return waitForFrame(); | 480 return waitForFrame(); |
| 481 } | 481 } |
| 482 } | 482 } |
| 483 | 483 |
| 484 function waitForFrame() | 484 function waitForFrame() |
| 485 { | 485 { |
| 486 var callback; | 486 var callback; |
| 487 var promise = new Promise((fulfill) => callback = fulfill); | 487 var promise = new Promise((fulfill) => callback = fulfill); |
| 488 if (window.testRunner) | 488 if (window.testRunner) |
| 489 testRunner.capturePixelsAsyncThen(() => window.requestAnimationFrame(cal
lback)); | 489 testRunner.capturePixelsAsyncThen(() => window.requestAnimationFrame(cal
lback)); |
| 490 else | 490 else |
| 491 window.requestAnimationFrame(callback); | 491 window.requestAnimationFrame(callback); |
| 492 return promise; | 492 return promise; |
| 493 } | 493 } |
| OLD | NEW |