Remove code under USE(GRAPHICS_SURFACE)
[WebKit-https.git] / LayoutTests / fast / canvas / webgl / webglcontextchangedevent.html
1 <script>
2 if (window.testRunner) {
3     testRunner.dumpAsText();
4     testRunner.waitUntilDone();
5 }
6
7 function log(msg)
8 {
9     let p = document.createElement("p");
10     p.textContent = msg;
11     document.body.appendChild(p);
12 }
13
14 function runTest()
15 {
16     if (!window.internals) {
17         log("This test must run inside DRT/WKTR.");
18         return;
19     }
20
21     log("We should see three changed events.");
22
23     let changedEventsSeen = 0;
24
25     let handleChangedEvent = (event) => {
26         log("Saw webglcontextchanged event.");
27         changedEventsSeen++;
28         if (changedEventsSeen == 3)
29             testRunner.notifyDone();
30     }
31
32     document.querySelectorAll("canvas").forEach((c) =>
33     {
34         c.addEventListener("webglcontextchanged", handleChangedEvent, false);
35         let gl = c.getContext("webgl");
36         gl.clearColor(1, 0, 0, 1);
37         gl.clear(gl.COLOR_BUFFER_BIT);
38     });
39
40     let gl = document.querySelector("canvas").getContext("webgl");
41     window.internals.simulateWebGLContextChanged(gl);
42 }
43
44
45 window.addEventListener("load", runTest, false);
46 </script>
47
48 <canvas></canvas>
49 <canvas></canvas>
50 <canvas></canvas>