Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector/tracing/decode-resize.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/decode-resize.html b/third_party/WebKit/LayoutTests/inspector/tracing/decode-resize.html |
| index 2a0d3054e9ca9fe36a4ce5a36c9ab6109f67ed3b..830f37bc95067d29a134f937e94a900fac1148db 100644 |
| --- a/third_party/WebKit/LayoutTests/inspector/tracing/decode-resize.html |
| +++ b/third_party/WebKit/LayoutTests/inspector/tracing/decode-resize.html |
| @@ -37,26 +37,24 @@ var images = [ |
| ["./resources/big.png", "150", "150"] |
| ]; |
| -function showImages(callback) |
| +function showImages() |
| { |
| - var nextImageIndex = 0; |
| - |
| - addImages(); |
| + var promise = Promise.resolve(); |
| + for (let image of images) { |
| + promise = promise |
| + .then(() => addImage(image)) |
|
caseq
2016/08/10 22:44:55
drop () =>
kozy
2016/08/11 01:34:16
I'd like to upload image and then run testRunner.l
|
| + .then(() => new Promise((fulfill) => testRunner.layoutAndPaintAsyncThen(fulfill))); |
|
caseq
2016/08/10 22:44:55
ditto
kozy
2016/08/11 01:34:16
Acknowledged.
|
| + } |
| + return promise.then(() => generateFrames(3)); |
| - function addImages() |
| + function addImage(image) |
| { |
| - if (nextImageIndex >= images.length) { |
| - // Allow several frames for image decoding to complete on rasterizer threads. |
| - generateFrames(3, callback); |
| - return; |
| - } |
| - |
| var imgContainer = document.createElement("div"); |
| imgContainer.className = "img-container"; |
| document.body.appendChild(imgContainer); |
| var imgElement = document.createElement("img"); |
| - imgElement.addEventListener("load", testRunner.layoutAndPaintAsyncThen.bind(testRunner, addImages)); |
| + var promise = new Promise((fulfill) => imgElement.onload = fulfill); |
| imgContainer.appendChild(imgElement); |
| var backgroundElement = document.createElement("div"); |
| @@ -67,16 +65,16 @@ function showImages(callback) |
| borderElement.className = "border"; |
| document.body.appendChild(borderElement); |
| - var image = images[nextImageIndex++]; |
| imgElement.width = image[1]; |
| imgElement.height = image[2]; |
| imgElement.src = image[0]; |
| backgroundElement.style.backgroundImage = "url(" + image[0] + "?background)"; |
| borderElement.style.borderImage = "url(" + image[0] + "?border)"; |
| + |
| + return promise; |
| } |
| } |
| - |
| function test() |
| { |
| InspectorTest.invokeWithTracing("showImages", InspectorTest.safeWrap(onTracingComplete)); |