Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-error-response.html

Issue 1384233003: Improve usefulness of webglcontextcreationerror statusMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- This is a test for crbug.com/412440, tests meaningful information in 1 <!-- This is a test for crbug.com/412440, tests meaningful information in
2 WebGL context creation error message. --> 2 WebGL context creation error message. -->
3 <script src="../../../resources/js-test.js"></script> 3 <script src="../../../resources/js-test.js"></script>
4 <canvas id="webgl-canvas" width="200" height="200" class="nomargin"></canvas> 4 <canvas id="webgl-canvas" width="200" height="200" class="nomargin"></canvas>
5 <script> 5 <script>
6 function main() 6 function main()
7 { 7 {
8 if (!window.testRunner) { 8 if (!window.testRunner) {
9 testFailed("Requires window.testRunner"); 9 testFailed("Requires window.testRunner");
10 } else { 10 } else {
11 initTest(); 11 initTest();
12 } 12 }
13 } 13 }
14 14
15 function initTest() { 15 function initTest() {
16 var canvas = document.getElementById("webgl-canvas"); 16 var canvas = document.getElementById("webgl-canvas");
17 testRunner.forceNextWebGLContextCreationToFail(); 17 testRunner.forceNextWebGLContextCreationToFail();
18 canvas.addEventListener("webglcontextcreationerror", onContextCreationError, f alse); 18 canvas.addEventListener("webglcontextcreationerror", onContextCreationError, f alse);
19 var gl = canvas.getContext("webgl"); 19 var gl = canvas.getContext("webgl");
20 testRunner.dumpAsText(); 20 testRunner.dumpAsText();
21 } 21 }
22 22
23 function onContextCreationError(e) { 23 function onContextCreationError(e) {
24 var splitStatus = e.statusMessage.split(","); 24 var splitStatus = e.statusMessage.split(",");
25 var stringLocator = 1; 25 var error = "";
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++) { 26 for (var i = 1; i < splitStatus.length; i++) {
29 var gpuInfoStr = splitStatus[i].split(" = "); 27 var gpuInfoStr = splitStatus[i].split(" = ");
30 if (gpuInfoStr[stringLocator] == "") 28 var key = gpuInfoStr[0].trim();
31 status = false; 29 var value = gpuInfoStr[1];
30 if (key == "DEVICE" && (value == "0x0000" || value == ""))
31 error = error + "DeviceID is null.";
32 if (key == "VENDOR" && (value == "0x0000" || value == ""))
33 error = error + "VendorID is null.";
34 if ((key == "GL_VENDOR" ||
35 key == "GL_RENDERER" ||
36 key == "GL_VERSION" ||
37 key == "Sandboxed" ||
38 key == "Optimus" ||
39 key == "AMD switchable" ||
40 key == "Reset notification strategy" ||
41 key == "GPU process crash count" ||
42 key == "ErrorMessage") && (value == "")) {
43 error = error + "Gpu data is incorrect.";
Zhenyao Mo 2015/10/16 18:46:12 We may not always have GL strings because we only
sivag 2015/10/19 16:19:23 Done.
44 }
Zhenyao Mo 2015/10/16 18:46:12 nit: indentation wrong.
sivag 2015/10/19 16:19:23 Done.
32 } 45 }
33 if(status) 46 if (error.length)
47 testFailed("webglcontextcreationerror test failed" + error);
48 else
34 testPassed("Status message displayed for webglcontextcreationerror"); 49 testPassed("Status message displayed for webglcontextcreationerror");
35 else 50
36 testFailed("Context creation error test failed");
37 } 51 }
38 main(); 52 main();
39 </script> 53 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698