| <script> |
| |
| if (window.testRunner) |
| window.testRunner.dumpAsText(); |
| |
| function getContext(name) { |
| var c = document.createElement("canvas"); |
| return c.getContext(name); |
| } |
| |
| function run() { |
| var output; |
| |
| output = document.getElementById("output1"); |
| |
| if (!window.testRunner) { |
| output.textContent = "This test only runs inside DRT/WKTR."; |
| return; |
| } |
| |
| window.internals.settings.setWebGL2Enabled(true); |
| var ctx = getContext("webgl2"); |
| if (ctx) |
| output.textContent = "PASS: WebGL 2.0 was available when enabled."; |
| else |
| output.textContent = "FAIL: WebGL 2.0 was not available when enabled."; |
| |
| output = document.getElementById("output2"); |
| |
| window.internals.settings.setWebGL2Enabled(false); |
| var ctx = getContext("webgl2"); |
| if (ctx) |
| output.textContent = "FAIL: WebGL 2.0 was available when disabled."; |
| else |
| output.textContent = "PASS: WebGL 2.0 was not available when disabled."; |
| } |
| |
| window.addEventListener("load", run, false); |
| |
| </script> |
| <div id="output1"></div> |
| <div id="output2"></div> |