testharness_worker.js (1112B)
1 {% if timeout %}// META: timeout={{ timeout }} 2 {% endif %} 3 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 4 // OffscreenCanvas test in a worker:{{ name }} 5 // Description:{{ desc }} 6 // Note:{% if notes %}<p class="notes">{{ notes }}{% endif +%} 7 8 importScripts("/resources/testharness.js"); 9 importScripts("/html/canvas/resources/canvas-tests.js"); 10 11 {# Promise vs. async test header: #} 12 {% if test_type == 'promise' %} 13 promise_test(async t => { 14 {% elif test_type == 'async' %} 15 async_test(t => { 16 {% elif test_type == 'sync' %} 17 test(t => { 18 {% else %} 19 var t = async_test("{{ desc | double_quote_escape }}"); 20 var t_pass = t.done.bind(t); 21 var t_fail = t.step_func(function(reason) { 22 throw reason; 23 }); 24 t.step(function() { 25 26 {% endif %} 27 28 {#- Test body: #} 29 var canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); 30 var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); 31 32 {{ code | trim | indent(2)}} 33 34 {#- Promise vs. async test footer: +#} 35 {% if not test_type %} 36 t.done(); 37 }); 38 {% else %} 39 }, "{{ desc | double_quote_escape }}"); 40 {% endif %} 41 done();