Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / webgl-drawing-buffer-error-response.html
bloba515ee771506015f1d98516ab637c8ec2037cd23
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>
4 <script>
5 function main()
7 if (!window.testRunner) {
8 testFailed("Requires window.testRunner");
9 } else {
10 initTest();
14 function initTest() {
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;
25 var status = true;
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] == "")
30 status = false;
32 if(status)
33 testPassed("Status message displayed for webglcontextcreationerror");
34 else
35 testFailed("Context creation error test failed");
37 main();
38 </script>