Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / canvas / test / test_offscreencanvas_many.html
blobad16ef62d4d801bd9f291ff8f5e1707055f59fa1
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>WebGL in OffscreenCanvas</title>
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
7 </head>
8 <body>
9 <!--
10 This test needs several workers run offscreen canvas simultaneously.
11 So we choose 8 workers, 4 of them run basic webgl drawing test and
12 others run size changing test.
13 -->
14 <script>
16 SimpleTest.waitForExplicitFinish();
18 function createCanvas() {
19 var htmlCanvas = document.createElement('canvas');
20 htmlCanvas.width = 64;
21 htmlCanvas.height = 64;
22 document.body.appendChild(htmlCanvas);
23 return htmlCanvas;
26 function runTest() {
27 var stillRunning = 0;
29 var startWorker = function(canvas, test) {
30 stillRunning++;
31 var worker = new Worker("offscreencanvas.js");
33 worker.onmessage = function(evt) {
34 var msg = evt.data || {};
35 if (msg.type == "test") {
36 ok(msg.result, msg.name);
38 if (msg.type == "finish") {
39 worker.terminate();
40 if (--stillRunning == 0)
41 SimpleTest.finish();
45 var offscreenCanvas = canvas.transferControlToOffscreen();
46 worker.postMessage({test, canvas: offscreenCanvas}, [offscreenCanvas]);
49 /* create 4 workers that do the regular drawing test and 4 workers
50 that do the size change test */
51 for (var i = 0; i < 4; i++) {
52 startWorker(createCanvas(), 'webgl');
55 for (var i = 0; i < 4; i++) {
56 startWorker(createCanvas(), 'webgl_changesize');
60 SpecialPowers.pushPrefEnv({'set': [
61 ['webgl.force-enabled', true]
62 ]}, runTest);
64 </script>
65 </body>
66 </html>