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

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

Issue 399043002: DevTools: switch Timeline frontend into buffered mode and remove the corresponding experiment. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: minor changes Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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
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 TimelineAgent.start(5, false, undefined, true, false, callback); 46 panel._userInitiatedRecording = true;
47 TimelineAgent.start(5, undefined, true, false, callback);
47 function addRecord(record) 48 function addRecord(record)
48 { 49 {
49 InspectorTest._timelineRecords.push(record); 50 InspectorTest._timelineRecords.push(record);
50 for (var i = 0; record.children && i < record.children.length; ++i) 51 for (var i = 0; record.children && i < record.children.length; ++i)
51 addRecord(record.children[i]); 52 addRecord(record.children[i]);
52 } 53 }
53 InspectorTest._addTimelineEvent = function(event) 54 InspectorTest._addTimelineEvent = function(event)
54 { 55 {
55 addRecord(event.data); 56 addRecord(event.data);
56 } 57 }
57 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineEventRecorded, InspectorTest._addTimelineEvent); 58 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineEventRecorded, InspectorTest._addTimelineEvent);
58 }; 59 };
59 60
60
61 InspectorTest.waitForRecordType = function(recordType, callback)
62 {
63 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineEventRecorded, addEvent);
64
65 function addEvent(event)
66 {
67 addRecord(event.data);
68 }
69 function addRecord(record)
70 {
71 if (record.type !== WebInspector.TimelineModel.RecordType[recordType]) {
72 for (var i = 0; record.children && i < record.children.length; ++i)
73 addRecord(record.children[i]);
74 return;
75 }
76 WebInspector.timelineManager.removeEventListener(WebInspector.TimelineMa nager.EventTypes.TimelineEventRecorded, addEvent);
77 callback(record);
78 }
79 }
80
81 InspectorTest.stopTimeline = function(callback) 61 InspectorTest.stopTimeline = function(callback)
82 { 62 {
83 function didStop() 63 function didStop(error)
84 { 64 {
65 if (error)
66 testRunner.logToStderr("error: " + error);
85 WebInspector.timelineManager.removeEventListener(WebInspector.TimelineMa nager.EventTypes.TimelineEventRecorded, InspectorTest._addTimelineEvent); 67 WebInspector.timelineManager.removeEventListener(WebInspector.TimelineMa nager.EventTypes.TimelineEventRecorded, InspectorTest._addTimelineEvent);
86 WebInspector.inspectorView.panel("timeline").toggleTimelineButton.toggle d = false; 68 var panel = WebInspector.inspectorView.panel("timeline");
87 WebInspector.inspectorView.panel("timeline")._model._collectionEnabled = false; 69 panel.toggleTimelineButton.toggled = false;
70 panel._userInitiatedRecording = false;
88 callback(InspectorTest._timelineRecords); 71 callback(InspectorTest._timelineRecords);
89 } 72 }
90 TimelineAgent.stop(didStop); 73 TimelineAgent.stop(didStop);
91 }; 74 };
92 75
93 InspectorTest.evaluateWithTimeline = function(actions, doneCallback) 76 InspectorTest.evaluateWithTimeline = function(actions, doneCallback)
94 { 77 {
95 InspectorTest.startTimeline(step1); 78 InspectorTest.startTimeline(step1);
96 function step1() 79 function step1()
97 { 80 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 InspectorTest.printTimelineRecords(typeName); 115 InspectorTest.printTimelineRecords(typeName);
133 if (includeTimeStamps) { 116 if (includeTimeStamps) {
134 InspectorTest.addResult("Timestamp records: "); 117 InspectorTest.addResult("Timestamp records: ");
135 InspectorTest.printTimestampRecords(typeName); 118 InspectorTest.printTimestampRecords(typeName);
136 } 119 }
137 InspectorTest.completeTest(); 120 InspectorTest.completeTest();
138 } 121 }
139 InspectorTest.evaluateWithTimeline(actions, callback); 122 InspectorTest.evaluateWithTimeline(actions, callback);
140 }; 123 };
141 124
125 InspectorTest.filterTimelineRecords = function(typeName, firstOnly)
126 {
127 var filteredRecords = [];
128 filterRecords(typeName, InspectorTest._timelineRecords);
129 return filteredRecords;
130
131 function filterRecords(typeName, records)
132 {
133 if (!records)
134 return false;
135 for (var i = 0; i < records.length; ++i) {
136 var recordTypeName = (typeof records[i].type === "string") ? records [i].type : records[i].type();
yurys 2014/07/17 10:42:24 This must always be type(), can we fix this?
137 if (typeName && recordTypeName === WebInspector.TimelineModel.Record Type[typeName]) {
138 filteredRecords.push(records[i]);
139 if (firstOnly)
140 return true;
141 }
142 if (filterRecords(typeName, records[i].children))
143 return true;
144 }
145 return false;
146 }
147 }
148
142 InspectorTest.printTimelineRecords = function(typeName, formatter) 149 InspectorTest.printTimelineRecords = function(typeName, formatter)
143 { 150 {
144 InspectorTest.innerPrintTimelineRecords(InspectorTest._timelineRecords, type Name, formatter); 151 InspectorTest.innerPrintTimelineRecords(InspectorTest._timelineRecords, type Name, formatter);
145 }; 152 };
146 153
147 InspectorTest.printTimelinePresentationRecords = function(typeName, formatter) 154 InspectorTest.printTimelinePresentationRecords = function(typeName, formatter)
148 { 155 {
149 InspectorTest.innerPrintTimelinePresentationRecords(WebInspector.panels.time line._model.records(), typeName, formatter); 156 InspectorTest.innerPrintTimelinePresentationRecords(WebInspector.panels.time line._model.records(), typeName, formatter);
150 }; 157 };
151 158
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 return this._fileSize; 362 return this._fileSize;
356 }, 363 },
357 364
358 fileName: function() 365 fileName: function()
359 { 366 {
360 return "fakeFile"; 367 return "fakeFile";
361 } 368 }
362 }; 369 };
363 370
364 }; 371 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698