3 <script src=
"../../../resources/js-test.js"></script>
4 <script src=
"resources/webgl-test.js"></script>
5 <script src=
"resources/webgl-test-utils.js"></script>
13 function createNewCanvas()
15 canvas
= document
.createElement("canvas");
19 context
= WebGLTestUtils
.create3DContext(canvas
);
20 extension
= context
.getExtension("WEBGL_lose_context");
22 debug("Could not find the WEBGL_lose_context extension.");
29 if (window
.initNonKhronosFramework
)
30 window
.initNonKhronosFramework(true);
32 canvas
.addEventListener("webglcontextlost", function(e
) {
34 debug("Test that the event passed to a listener of webglcontextlost is a WebGLContextEvent.")
35 shouldBe("evt.toString()", "'[object WebGLContextEvent]'");
36 shouldBe("evt.statusMessage", "''");
37 // Start the next test when event dispatch has finished.
38 setTimeout(function() {
42 extension
.loseContext();
48 canvas
.addEventListener("webglcontextlost", function(e
) {
50 // Restore the context after event dispatch has finished.
51 setTimeout(function() {
52 // Because context restoration is specified as being asynchronous, we can not verify
53 // that the GL error state is empty here.
54 extension
.restoreContext();
57 canvas
.addEventListener("webglcontextrestored", function(e
) {
59 shouldBe("context.getError()", "context.NO_ERROR");
60 debug("Test that the event passed to a listener of webglcontextrestored is a WebGLContextEvent.")
61 shouldBe("evt.toString()", "'[object WebGLContextEvent]'");
62 shouldBe("evt.statusMessage", "''");
64 setTimeout(finish
, 0);
66 extension
.loseContext();
76 <body onload=
"runTest1()">
77 <div id=
"description"></div>
78 <div id=
"console"></div>