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

Unified Diff: third_party/WebKit/LayoutTests/inspector/tracing/decode-resize.html

Issue 2208963002: [DevTools] Removed InspectorTest.invokeFunctionInPageAsync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-promise-from-other-tests
Patch Set: a Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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))
+ .then(() => new Promise((fulfill) => testRunner.layoutAndPaintAsyncThen(fulfill)));
+ }
+ 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));

Powered by Google App Engine
This is Rietveld 408576698