Commit ee7626e7 authored by Juanmi Huertas's avatar Juanmi Huertas Committed by Commit Bot

Fixing tranferFromimageBitmap-toBlob-offscreen.html to not be flaky

Replacing the getElementById by the creation of a new element to ensure
that the test will not be flaky.

Changing also the name of the function to be coherent with the test itself.

Bug: 978554
Change-Id: I8848b18f6d7f6201cce57069c5f4047d4d2f61e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1693189
Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677456}
parent 1ead3ff6
...@@ -15,13 +15,13 @@ function testCanvas(ctx, r, g, b, a) ...@@ -15,13 +15,13 @@ function testCanvas(ctx, r, g, b, a)
} }
promise_test(function() { promise_test(function() {
function testTransferFromImageBitmapNullability(greenImage) { function testTransferFromImageBitmapToBlobOffscreen(greenImage) {
var bitmapCanvas = new OffscreenCanvas(width,height); var bitmapCanvas = new OffscreenCanvas(width,height);
var bitmapCtx = bitmapCanvas.getContext('bitmaprenderer'); var bitmapCtx = bitmapCanvas.getContext('bitmaprenderer');
bitmapCtx.transferFromImageBitmap(greenImage); bitmapCtx.transferFromImageBitmap(greenImage);
// Make sure the bitmap renderer canvas is filled correctly. // Make sure the bitmap renderer canvas is filled correctly.
var pngImage = document.getElementById("img"); var pngImage = new Image();
bitmapCanvas.convertToBlob().then(function(blob){ bitmapCanvas.convertToBlob().then(function(blob){
pngImage.src = URL.createObjectURL(blob); pngImage.src = URL.createObjectURL(blob);
var myCanvasToTest = document.createElement('canvas'); var myCanvasToTest = document.createElement('canvas');
...@@ -43,7 +43,7 @@ promise_test(function() { ...@@ -43,7 +43,7 @@ promise_test(function() {
return Promise.all([ return Promise.all([
createImageBitmap(greenCanvas), createImageBitmap(greenCanvas),
]).then(([greenImage]) => { ]).then(([greenImage]) => {
testTransferFromImageBitmapNullability(greenImage); testTransferFromImageBitmapToBlobOffscreen(greenImage);
}); });
},'Test that transferToBlob works and produce the expected image'); },'Test that transferToBlob works and produce the expected image');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment