canvas-promise-test-worker.js (1018B)
1 /** Worker script needed by canvas-test.js. */ 2 3 /** 4 * Worker version of `canvasPromiseTest()`, running `testBody` with an 5 * `OffscreenCanvas` in a worker. For more details, see the main thread version 6 * of this function in `canvas-test.js`. 7 */ 8 function canvasPromiseTest( 9 testBody, description, 10 {testTypes = Object.values(CanvasTestType)} = {}) { 11 if (testTypes.includes(CanvasTestType.WORKER)) { 12 promise_test(() => testBody(new OffscreenCanvas(300, 150), 13 {canvasType: CanvasTestType.WORKER}), 14 'Worker: ' + description); 15 } 16 } 17 18 /** 19 * The function `runCanvasTestsInWorker()` in `canvas-test.js` re-executes the 20 * current script in a worker. That script inevitably contain the call to 21 * `runCanvasTestsInWorker()`, which triggered the whole thing. For that call 22 * to succeed, the worker must have a definition for that function. There's 23 * nothing to do here though, the script is already running in a worker. 24 */ 25 function runCanvasTestsInWorker() {}