Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / WebGLContextEvent.html
blobf05701eb8bde250b65d1c4972d045f6d2fd6d75f
1 <html>
2 <head>
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>
6 <script>
8 var evt;
9 var canvas;
10 var context;
11 var extension;
13 function createNewCanvas()
15 canvas = document.createElement("canvas");
16 canvas.width = 1;
17 canvas.height = 1;
19 context = WebGLTestUtils.create3DContext(canvas);
20 extension = context.getExtension("WEBGL_lose_context");
21 if (!extension) {
22 debug("Could not find the WEBGL_lose_context extension.");
23 return;
27 function runTest1()
29 if (window.initNonKhronosFramework)
30 window.initNonKhronosFramework(true);
31 createNewCanvas();
32 canvas.addEventListener("webglcontextlost", function(e) {
33 evt = 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() {
39 runTest2();
40 }, 0);
41 }, false);
42 extension.loseContext();
45 function runTest2()
47 createNewCanvas();
48 canvas.addEventListener("webglcontextlost", function(e) {
49 e.preventDefault();
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();
55 }, 0);
56 }, false);
57 canvas.addEventListener("webglcontextrestored", function(e) {
58 evt = 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);
65 }, false);
66 extension.loseContext();
69 function finish() {
70 finishJSTest();
73 </script>
75 </head>
76 <body onload="runTest1()">
77 <div id="description"></div>
78 <div id="console"></div>
79 <canvas id="canvas">
80 </body>
81 </html>