1 <!-- This is a test to ensure that drawing buffer creation failure gracefully fails WebGL context creation -->
2 <script src=
"../../../resources/js-test.js"></script>
3 <canvas id=
"webgl-canvas" width=
"200" height=
"200" class=
"nomargin"></canvas>
7 if (!window
.testRunner
) {
8 testFailed("Requires window.testRunner");
15 var canvas
= document
.getElementById("webgl-canvas");
16 testRunner
.forceNextDrawingBufferCreationToFail();
17 canvas
.addEventListener("webglcontextcreationerror", onContextCreationError
, false);
18 var gl
= canvas
.getContext("webgl");
19 testRunner
.dumpAsText();
22 function onContextCreationError(e
) {
23 var splitStatus
= e
.statusMessage
.split(",");
24 var stringLocator
= 1;
26 // Start iterating from 1 as , the initial message has no data.
27 for (var i
= 1; i
< splitStatus
.length
; i
++) {
28 var gpuInfoStr
= splitStatus
[i
].split(" = ");
29 if (gpuInfoStr
[stringLocator
] == "")
33 testPassed("Status message displayed for webglcontextcreationerror");
35 testFailed("Context creation error test failed");