Skip to content

Commit

Permalink
Remove useless t.done() in worker promise tests (web-platform-tests#4…
Browse files Browse the repository at this point in the history
…5548)

Promise tests complete when their promise settles. Calling t.done() is
not required.

Bug: 330885075
Change-Id: I496b2222a47983536053218075b03b829b191e3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5392061
Commit-Queue: Jean-Philippe Gravel <jpgravel@chromium.org>
Reviewed-by: Andres Ricardo Perez <andresrperez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1282154}

Co-authored-by: Jean-Philippe Gravel <jpgravel@chromium.org>
  • Loading branch information
chromium-wpt-export-bot and graveljp authored Apr 4, 2024
1 parent ba78e8f commit 2b71570
Show file tree
Hide file tree
Showing 93 changed files with 3 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -21,6 +20,5 @@ promise_test(async t => {

ctx.drawImage(bitmap, 0, 0);
_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -22,6 +21,5 @@ promise_test(async t => {
ctx.globalAlpha = 0.01;
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 50,25, 2,253,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -28,6 +27,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2);
_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2);
_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -29,6 +28,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2);
_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2);
_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -22,6 +21,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2);
_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2);
_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -28,6 +27,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2);
_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2);
_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -30,6 +29,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2);
_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2);
_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -21,6 +20,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 99,0, 0,255,0,255, 2);
_assertPixelApprox(canvas, 0,49, 0,255,0,255, 2);
_assertPixelApprox(canvas, 99,49, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -28,6 +27,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 80,20, 0,255,0,255, 2);
_assertPixelApprox(canvas, 20,30, 0,255,0,255, 2);
_assertPixelApprox(canvas, 80,30, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -20,6 +19,5 @@ promise_test(async t => {

ctx.drawImage(bitmap, 0, 0);
_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

const response = await fetch('/images/broken.png');
const blob = await response.blob();

await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(blob), 'The source image could not be decoded.');
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -25,6 +24,5 @@ promise_test(async t => {
ctx.clip();
ctx.drawImage(bitmap, 0, 0);
_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -20,6 +19,5 @@ promise_test(async t => {

ctx.drawImage(bitmap, 0, 0);
_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -16,6 +15,5 @@ promise_test(async t => {
const bitmap = await createImageBitmap(blob);
ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50);
_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -28,6 +27,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 51,48, 0,255,0,255, 2);
_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2);
_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2);
t.done();
}, "Negative destination width/height represents the correct rectangle");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -28,6 +27,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 51,48, 0,255,0,255, 2);
_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2);
_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2);
t.done();
}, "Negative dimensions do not affect the direction of the image");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -28,6 +27,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 51,48, 0,255,0,255, 2);
_assertPixelApprox(canvas, 25,25, 0,255,0,255, 2);
_assertPixelApprox(canvas, 75,25, 0,255,0,255, 2);
t.done();
}, "Negative source width/height represents the correct rectangle");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand Down Expand Up @@ -319,6 +318,5 @@ promise_test(async t => {
ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity);
ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
}, "drawImage() with Infinity/NaN is ignored");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -21,6 +20,5 @@ promise_test(async t => {
_assertPixelApprox(canvas, 45,25, 0,255,0,255, 2);
_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
_assertPixelApprox(canvas, 55,25, 0,255,0,255, 2);
t.done();
}, "Stretched images do not get pixels wrapping around the edges");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -20,6 +19,5 @@ promise_test(async t => {
ctx.drawImage(bitmap, 0, 0);
ctx.fill();
_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -20,6 +19,5 @@ promise_test(async t => {

ctx.drawImage(bitmap, 0, 0);
_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -20,6 +19,5 @@ promise_test(async t => {
ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50);
ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50);
_assertPixelApprox(canvas, 50,25, 0,255,0,255, 2);
t.done();
}, "drawImage with zero-sized source rectangle draws nothing without exception");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -24,6 +23,5 @@ promise_test(async t => {
_assertPixel(canvas, 98,1, 0,255,0,255);
_assertPixel(canvas, 1,48, 0,255,0,255);
_assertPixel(canvas, 98,48, 0,255,0,255);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -20,6 +19,5 @@ promise_test(async t => {
var img = await createImageBitmap(blob);
var pattern = ctx.createPattern(img, 'no-repeat');
_assert(pattern.thisImplementsCanvasPattern, "pattern.thisImplementsCanvasPattern");
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -22,6 +21,5 @@ promise_test(async t => {
ctx.fillRect(0, 0, 100, 50);

_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
}, "");
done();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

promise_test(async t => {

var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');

Expand All @@ -25,6 +24,5 @@ promise_test(async t => {
_assertPixel(canvas, 98,1, 0,255,0,255);
_assertPixel(canvas, 1,48, 0,255,0,255);
_assertPixel(canvas, 98,48, 0,255,0,255);
t.done();
}, "");
done();
Loading

0 comments on commit 2b71570

Please sign in to comment.