Skip to content

[offscreen-canvas] Procedurally-generated tests are invalid #20180

@jugglinmike

Description

@jugglinmike

Many of the tests which are generated programmatically report results before any assertions are made. The tests' "template" code defines a single subtest:

var t = async_test("%(escaped_desc)s");
t.step(function() {

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

%(code)s
t.done();

});

Although declared using the async_test API, the invocation of the t.done method in the test body makes these tests fully synchronous. However, many of the code excerpts used to expand this template include asynchronous operations, e.g. compositing/2d.composite.canvas.copy.html

In the absence of additional subtests, asynchronous code cannot influence the results reported by testharness.js.

There are many ways this could be addressed, but the most straightforward may be to relocate the invocation of t.done from the template and into each of the code excerpts. This would also be a good opportunity to wrap asynchronously-executed functions with the t.step_func method (otherwise, test failures will be reported as harness errors).

/cc @AmeliaBR @annevk @kenrussell @fserb

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions