Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js |
| index 5df5b56ada75dc47b7a091e02da4ca97e2eaa0c5..d0bdcfc5c3c27cb2caed00ea1a9e662770a6b775 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js |
| +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js |
| @@ -93,7 +93,7 @@ InspectorTest.invokeWithTracing = function(functionName, callback, additionalCat |
| function tracingStarted() |
| { |
| - InspectorTest.invokePageFunctionAsync(functionName, onPageActionsDone); |
| + InspectorTest.callFunctionInPageAsync(functionName).then(onPageActionsDone); |
| } |
| function onPageActionsDone() |
| @@ -173,7 +173,7 @@ InspectorTest.invokeAsyncWithTimeline = function(functionName, doneCallback) |
| InspectorTest.startTimeline(step1); |
| function step1() |
| { |
| - InspectorTest.invokePageFunctionAsync(functionName, step2); |
| + InspectorTest.callFunctionInPageAsync(functionName).then(step2); |
| } |
| function step2() |
| @@ -461,19 +461,24 @@ InspectorTest.loadTimeline = function(timelineData) |
| }; |
| -function generateFrames(count, callback) |
| +function generateFrames(count) |
| { |
| - makeFrame(); |
| - function makeFrame() |
| - { |
| - document.body.style.backgroundColor = count & 1 ? "rgb(200, 200, 200)" : "rgb(240, 240, 240)"; |
| - if (!--count) { |
| - callback(); |
| - return; |
| - } |
| - if (window.testRunner) |
| - testRunner.capturePixelsAsyncThen(requestAnimationFrame.bind(window, makeFrame)); |
| - else |
| - window.requestAnimationFrame(makeFrame); |
| + var promise = Promise.resolve(); |
| + for (let i = count; i > 0; --i) { |
| + promise = promise |
| + .then(() => document.body.style.backgroundColor = i & 1 ? "rgb(200, 200, 200)" : "rgb(240, 240, 240)") |
| + .then(() => waitForFrame()); |
|
caseq
2016/08/10 22:44:55
merge into above?
kozy
2016/08/11 01:34:16
Done.
|
| } |
| + return promise; |
| +} |
| + |
| +function waitForFrame() |
| +{ |
| + var callback; |
| + var promise = new Promise((fulfill) => callback = fulfill); |
| + if (window.testRunner) |
|
caseq
2016/08/10 22:44:55
inline into the Promise() constructor?
kozy
2016/08/11 01:34:16
Acknowledged.
|
| + testRunner.capturePixelsAsyncThen(() => window.requestAnimationFrame(callback)); |
| + else |
| + window.requestAnimationFrame(callback); |
| + return promise; |
| } |