| OLD | NEW |
| 1 var initialize_Timeline = function() { | 1 var initialize_Timeline = function() { |
| 2 | 2 |
| 3 // Scrub values when printing out these properties in the record or data field. | 3 // Scrub values when printing out these properties in the record or data field. |
| 4 InspectorTest.timelinePropertyFormatters = { | 4 InspectorTest.timelinePropertyFormatters = { |
| 5 children: "formatAsTypeName", | 5 children: "formatAsTypeName", |
| 6 endTime: "formatAsTypeName", | 6 endTime: "formatAsTypeName", |
| 7 requestId: "formatAsTypeName", | 7 requestId: "formatAsTypeName", |
| 8 startTime: "formatAsTypeName", | 8 startTime: "formatAsTypeName", |
| 9 stackTrace: "formatAsTypeName", | 9 stackTrace: "formatAsTypeName", |
| 10 url: "formatAsURL", | 10 url: "formatAsURL", |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 InspectorTest.timelineModel = function() | 36 InspectorTest.timelineModel = function() |
| 37 { | 37 { |
| 38 return WebInspector.panels.timeline._model; | 38 return WebInspector.panels.timeline._model; |
| 39 } | 39 } |
| 40 | 40 |
| 41 InspectorTest.startTimeline = function(callback) | 41 InspectorTest.startTimeline = function(callback) |
| 42 { | 42 { |
| 43 InspectorTest._timelineRecords = []; | 43 InspectorTest._timelineRecords = []; |
| 44 WebInspector.inspectorView.panel("timeline").toggleTimelineButton.toggled =
true; | 44 var panel = WebInspector.inspectorView.panel("timeline"); |
| 45 WebInspector.inspectorView.panel("timeline")._model._collectionEnabled = tru
e; | 45 panel.toggleTimelineButton.toggled = true; |
| 46 WebInspector.inspectorView.panel("timeline")._model._currentTarget = WebInsp
ector.targetManager.mainTarget(); | 46 panel._model._collectionEnabled = true; |
| 47 | 47 panel._userInitiatedRecording = true; |
| 48 TimelineAgent.start(5, false, undefined, true, false, callback); | 48 panel._model._currentTarget = WebInspector.targetManager.mainTarget(); |
| 49 TimelineAgent.start(5, true, undefined, true, false, callback); |
| 49 function addRecord(record) | 50 function addRecord(record) |
| 50 { | 51 { |
| 51 InspectorTest._timelineRecords.push(record); | 52 InspectorTest._timelineRecords.push(record); |
| 52 for (var i = 0; record.children && i < record.children.length; ++i) | 53 for (var i = 0; record.children && i < record.children.length; ++i) |
| 53 addRecord(record.children[i]); | 54 addRecord(record.children[i]); |
| 54 } | 55 } |
| 55 InspectorTest._addTimelineEvent = function(event) | 56 InspectorTest._addTimelineEvent = function(event) |
| 56 { | 57 { |
| 57 addRecord(event.data); | 58 addRecord(event.data); |
| 58 } | 59 } |
| 59 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E
ventTypes.TimelineEventRecorded, InspectorTest._addTimelineEvent); | 60 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E
ventTypes.TimelineEventRecorded, InspectorTest._addTimelineEvent); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 | |
| 63 InspectorTest.waitForRecordType = function(recordType, callback) | |
| 64 { | |
| 65 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E
ventTypes.TimelineEventRecorded, addEvent); | |
| 66 | |
| 67 function addEvent(event) | |
| 68 { | |
| 69 addRecord(event.data); | |
| 70 } | |
| 71 function addRecord(record) | |
| 72 { | |
| 73 if (record.type !== WebInspector.TimelineModel.RecordType[recordType]) { | |
| 74 for (var i = 0; record.children && i < record.children.length; ++i) | |
| 75 addRecord(record.children[i]); | |
| 76 return; | |
| 77 } | |
| 78 WebInspector.timelineManager.removeEventListener(WebInspector.TimelineMa
nager.EventTypes.TimelineEventRecorded, addEvent); | |
| 79 callback(record); | |
| 80 } | |
| 81 } | |
| 82 | |
| 83 InspectorTest.stopTimeline = function(callback) | 63 InspectorTest.stopTimeline = function(callback) |
| 84 { | 64 { |
| 85 function didStop() | 65 function didStop(error) |
| 86 { | 66 { |
| 67 if (error) |
| 68 testRunner.logToStderr("error: " + error); |
| 87 WebInspector.timelineManager.removeEventListener(WebInspector.TimelineMa
nager.EventTypes.TimelineEventRecorded, InspectorTest._addTimelineEvent); | 69 WebInspector.timelineManager.removeEventListener(WebInspector.TimelineMa
nager.EventTypes.TimelineEventRecorded, InspectorTest._addTimelineEvent); |
| 88 WebInspector.inspectorView.panel("timeline").toggleTimelineButton.toggle
d = false; | 70 var panel = WebInspector.inspectorView.panel("timeline"); |
| 89 WebInspector.inspectorView.panel("timeline")._model._collectionEnabled =
false; | 71 panel.toggleTimelineButton.toggled = false; |
| 72 panel._userInitiatedRecording = false; |
| 90 callback(InspectorTest._timelineRecords); | 73 callback(InspectorTest._timelineRecords); |
| 91 } | 74 } |
| 92 TimelineAgent.stop(didStop); | 75 TimelineAgent.stop(didStop); |
| 93 }; | 76 }; |
| 94 | 77 |
| 95 InspectorTest.evaluateWithTimeline = function(actions, doneCallback) | 78 InspectorTest.evaluateWithTimeline = function(actions, doneCallback) |
| 96 { | 79 { |
| 97 InspectorTest.startTimeline(step1); | 80 InspectorTest.startTimeline(step1); |
| 98 function step1() | 81 function step1() |
| 99 { | 82 { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 InspectorTest.printTimelineRecords(typeName); | 117 InspectorTest.printTimelineRecords(typeName); |
| 135 if (includeTimeStamps) { | 118 if (includeTimeStamps) { |
| 136 InspectorTest.addResult("Timestamp records: "); | 119 InspectorTest.addResult("Timestamp records: "); |
| 137 InspectorTest.printTimestampRecords(typeName); | 120 InspectorTest.printTimestampRecords(typeName); |
| 138 } | 121 } |
| 139 InspectorTest.completeTest(); | 122 InspectorTest.completeTest(); |
| 140 } | 123 } |
| 141 InspectorTest.evaluateWithTimeline(actions, callback); | 124 InspectorTest.evaluateWithTimeline(actions, callback); |
| 142 }; | 125 }; |
| 143 | 126 |
| 127 InspectorTest.filterTimelineRecords = function(typeName, firstOnly) |
| 128 { |
| 129 var filteredRecords = []; |
| 130 filterRecords(typeName, InspectorTest._timelineRecords); |
| 131 return filteredRecords; |
| 132 |
| 133 function filterRecords(typeName, records) |
| 134 { |
| 135 if (!records) |
| 136 return false; |
| 137 for (var i = 0; i < records.length; ++i) { |
| 138 var recordTypeName = (typeof records[i].type === "string") ? records
[i].type : records[i].type(); |
| 139 if (typeName && recordTypeName === WebInspector.TimelineModel.Record
Type[typeName]) { |
| 140 filteredRecords.push(records[i]); |
| 141 if (firstOnly) |
| 142 return true; |
| 143 } |
| 144 if (filterRecords(typeName, records[i].children)) |
| 145 return true; |
| 146 } |
| 147 return false; |
| 148 } |
| 149 } |
| 150 |
| 144 InspectorTest.printTimelineRecords = function(typeName, formatter) | 151 InspectorTest.printTimelineRecords = function(typeName, formatter) |
| 145 { | 152 { |
| 146 InspectorTest.innerPrintTimelineRecords(InspectorTest._timelineRecords, type
Name, formatter); | 153 InspectorTest.innerPrintTimelineRecords(InspectorTest._timelineRecords, type
Name, formatter); |
| 147 }; | 154 }; |
| 148 | 155 |
| 149 InspectorTest.printTimelinePresentationRecords = function(typeName, formatter) | 156 InspectorTest.printTimelinePresentationRecords = function(typeName, formatter) |
| 150 { | 157 { |
| 151 InspectorTest.innerPrintTimelinePresentationRecords(WebInspector.panels.time
line._model.records(), typeName, formatter); | 158 InspectorTest.innerPrintTimelinePresentationRecords(WebInspector.panels.time
line._model.records(), typeName, formatter); |
| 152 }; | 159 }; |
| 153 | 160 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 return this._fileSize; | 364 return this._fileSize; |
| 358 }, | 365 }, |
| 359 | 366 |
| 360 fileName: function() | 367 fileName: function() |
| 361 { | 368 { |
| 362 return "fakeFile"; | 369 return "fakeFile"; |
| 363 } | 370 } |
| 364 }; | 371 }; |
| 365 | 372 |
| 366 }; | 373 }; |
| OLD | NEW |