Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / webgl-error-response.html
blobe866a237d28b4586468b4b98cd73958ea3459593
1 <!-- This is a test for crbug.com/412440, tests meaningful information in
2 WebGL context creation error message. -->
3 <script src="../../../resources/js-test.js"></script>
4 <canvas id="webgl-canvas" width="200" height="200" class="nomargin"></canvas>
5 <script>
6 function main()
8 if (!window.testRunner) {
9 testFailed("Requires window.testRunner");
10 } else {
11 initTest();
15 function initTest() {
16 var canvas = document.getElementById("webgl-canvas");
17 testRunner.forceNextWebGLContextCreationToFail();
18 canvas.addEventListener("webglcontextcreationerror", onContextCreationError, false);
19 var gl = canvas.getContext("webgl");
20 testRunner.dumpAsText();
23 function onContextCreationError(e) {
24 var splitStatus = e.statusMessage.split(",");
25 var stringLocator = 1;
26 var status = true;
27 // Start iterating from 1 as , the initial message has no data.
28 for (var i = 1; i < splitStatus.length; i++) {
29 var gpuInfoStr = splitStatus[i].split(" = ");
30 if (gpuInfoStr[stringLocator] == "")
31 status = false;
33 if(status)
34 testPassed("Status message displayed for webglcontextcreationerror");
35 else
36 testFailed("Context creation error test failed");
38 main();
39 </script>