summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js
blob: f1f04e7bb6bcf370e0db53f08dd38899e72e55ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{% if timeout %}// META: timeout={{ timeout }}{% endif %}
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
// OffscreenCanvas test in a worker:{{ name }}
// Description:{{ desc }}
// Note:{% if notes %}<p class="notes">{{ notes }}{% endif +%}

importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

{# Promise vs. async test header: #}
{% if test_type == 'promise' %}
promise_test(async t => {
{% else %}
var t = async_test("{{ desc | double_quote_escape }}");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
    throw reason;
});
t.step(function() {
{% endif %}

{# Test body: #}
  var canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }});
  var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %});

  {{ code | trim | indent(2)}}
  t.done();

{#- Promise vs. async test footer: +#}
{% if test_type == 'promise' %}
}, "{{ desc }}");
{% else %}
});
{% endif %}
done();