Chromium Code Reviews| Index: chrome/test/data/gpu/feature_webgl.html |
| diff --git a/chrome/test/data/gpu/feature_webgl.html b/chrome/test/data/gpu/feature_webgl.html |
| index cd6566d64740a6dc2b571a2195aef379124d6b0f..c57be092f530f379ea7309cae24e2e7e4297b59e 100644 |
| --- a/chrome/test/data/gpu/feature_webgl.html |
| +++ b/chrome/test/data/gpu/feature_webgl.html |
| @@ -4,24 +4,44 @@ |
| <meta charset="utf-8"> |
| <title>GPU Feature Testing: WebGL</title> |
| <script> |
| +var frameCount = 0; |
| +var gl = null; |
| + |
| function init() { |
| - var canvas = document.createElement("canvas"); |
| + var canvas = document.getElementById("da-canvas"); |
| if (!canvas) |
| - return null; |
| - var context = null; |
| + return; |
| try { |
| - context = canvas.getContext("webgl"); |
| + gl = canvas.getContext("webgl"); |
| } catch(e) {} |
| - if (!context) { |
| + if (!gl) { |
| try { |
| - context = canvas.getContext("experimental-webgl"); |
| + gl = canvas.getContext("experimental-webgl"); |
| } catch(e) {} |
| } |
| - return context; |
| } |
| function runTest() { |
| - var gl = init(); |
| + init(); |
| + if (gl) |
| + window.webkitRequestAnimationFrame(draw); |
| + else |
| + endTest(); |
| +} |
| + |
| +function draw() { |
| + frameCount++; |
| + gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight); |
|
Zhenyao Mo
2011/11/30 18:58:47
I don't think viewportWidth/Height are supported.
jbates
2011/11/30 20:21:52
Done.
|
| + gl.clearColor(1.0/frameCount, 0.0, 0.0, 1.0); |
| + gl.clear(gl.COLOR_BUFFER_BIT); |
| + if (frameCount == 5) { |
| + endTest(); |
| + } else { |
| + window.webkitRequestAnimationFrame(draw); |
| + } |
| +} |
| + |
| +function endTest() { |
| domAutomationController.setAutomationId(1); |
| domAutomationController.send("FINISHED"); |
| } |
| @@ -29,5 +49,6 @@ function runTest() { |
| </head> |
| <body onload="runTest()"> |
| WebGL should trigger GPU process launch if it is allowed. |
| +<canvas id="da-canvas" width="500" height="500"></canvas> |
| </body> |
| </html> |