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

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

Issue 2717393003: [DevTools] Turn starting tracing into promise. (Closed)
Patch Set: Created 3 years, 9 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 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");
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 InspectorTest.invokeWithTracing = function(functionName, callback, additionalCat egories, enableJSSampling) 85 InspectorTest.invokeWithTracing = function(functionName, callback, additionalCat egories, enableJSSampling)
86 { 86 {
87 var categories = "-*,disabled-by-default-devtools.timeline*,devtools.timelin e," + SDK.TracingModel.TopLevelEventCategory; 87 var categories = "-*,disabled-by-default-devtools.timeline*,devtools.timelin e," + SDK.TracingModel.TopLevelEventCategory;
88 if (additionalCategories) 88 if (additionalCategories)
89 categories += "," + additionalCategories; 89 categories += "," + additionalCategories;
90 var timelinePanel = UI.panels.timeline; 90 var timelinePanel = UI.panels.timeline;
91 var timelineController = InspectorTest.timelineController(); 91 var timelineController = InspectorTest.timelineController();
92 timelinePanel._timelineController = timelineController; 92 timelinePanel._timelineController = timelineController;
93 timelineController._startRecordingWithCategories(categories, enableJSSamplin g, tracingStarted); 93 timelineController._startRecordingWithCategories(categories, enableJSSamplin g).then(tracingStarted);
94 94
95 function tracingStarted() 95 function tracingStarted()
96 { 96 {
97 InspectorTest.callFunctionInPageAsync(functionName).then(onPageActionsDo ne); 97 InspectorTest.callFunctionInPageAsync(functionName).then(onPageActionsDo ne);
98 } 98 }
99 99
100 function onPageActionsDone() 100 function onPageActionsDone()
101 { 101 {
102 InspectorTest.runWhenTimelineIsReady(callback); 102 InspectorTest.runWhenTimelineIsReady(callback);
103 timelineController.stopRecording(); 103 timelineController.stopRecording();
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 function waitForFrame() 444 function waitForFrame()
445 { 445 {
446 var callback; 446 var callback;
447 var promise = new Promise((fulfill) => callback = fulfill); 447 var promise = new Promise((fulfill) => callback = fulfill);
448 if (window.testRunner) 448 if (window.testRunner)
449 testRunner.capturePixelsAsyncThen(() => window.requestAnimationFrame(cal lback)); 449 testRunner.capturePixelsAsyncThen(() => window.requestAnimationFrame(cal lback));
450 else 450 else
451 window.requestAnimationFrame(callback); 451 window.requestAnimationFrame(callback);
452 return promise; 452 return promise;
453 } 453 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698