OLD | NEW |
(Empty) | |
| 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() |
| 7 { |
| 8 if (!window.testRunner) { |
| 9 testFailed("Requires window.testRunner"); |
| 10 } else { |
| 11 initTest(); |
| 12 } |
| 13 } |
| 14 |
| 15 function initTest() { |
| 16 var canvas = document.getElementById("webgl-canvas"); |
| 17 testRunner.forceNextWebGLContextCreationToFail(); |
| 18 canvas.addEventListener("webglcontextcreationerror", onContextCreationError, f
alse); |
| 19 var gl = canvas.getContext("webgl"); |
| 20 testRunner.dumpAsText(); |
| 21 } |
| 22 |
| 23 function onContextCreationError(e) { |
| 24 var vendorInfoStr = "VendorInfo = "; |
| 25 var renderInfoStr = "RendererInfo = "; |
| 26 var driverInfoStr = "DriverInfo = "; |
| 27 var stringIndex = e.statusMessage.search(vendorInfoStr) + vendorInfoStr.length
; |
| 28 var vendorInfo = e.statusMessage.substring(stringIndex, e.statusMessage.search
(renderInfoStr) - 2); |
| 29 stringIndex = e.statusMessage.search(renderInfoStr) + renderInfoStr.length; |
| 30 var rendererInfo = e.statusMessage.substring(stringIndex, e.statusMessage.sear
ch(driverInfoStr) - 2 ); |
| 31 stringIndex = e.statusMessage.search(driverInfoStr) + driverInfoStr.length; |
| 32 var driverInfo = e.statusMessage.substring(stringIndex, e.statusMessage.length
- 1); |
| 33 if((e.statusMessage.search("GPUInfoCollectionFailure") != -1) || |
| 34 vendorInfo.length > 0 || |
| 35 rendererInfo.length > 0 || |
| 36 driverInfo.length > 0) |
| 37 testPassed("Status message displayed for webglcontextcreationerror"); |
| 38 else |
| 39 testFailed("Context creation error test failed"); |
| 40 } |
| 41 main(); |
| 42 </script> |
OLD | NEW |