- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / gpu / feature_webgl.html
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>GPU Feature Testing: WebGL</title>
6 <script>
7 var frameCount = 0;
8 var gl = null;
9
10 function init() {
11   var canvas = document.getElementById("da-canvas");
12   if (!canvas)
13     return;
14   try {
15     gl = canvas.getContext("webgl");
16   } catch(e) {}
17   if (!gl) {
18     try {
19       gl = canvas.getContext("experimental-webgl");
20     } catch(e) {}
21   }
22 }
23
24 function runTest() {
25   init();
26   if (gl)
27     window.webkitRequestAnimationFrame(draw);
28   else
29     endTest();
30 }
31
32 function draw() {
33   frameCount++;
34   gl.viewport(0, 0, 10, 10);
35   gl.clearColor(1.0/frameCount, 0.0, 0.0, 1.0);
36   gl.clear(gl.COLOR_BUFFER_BIT);
37   if (frameCount == 6) {
38     endTest();
39   } else {
40     window.webkitRequestAnimationFrame(draw);
41   }
42 }
43
44 function endTest() {
45   domAutomationController.setAutomationId(1);
46   domAutomationController.send("FINISHED");
47 }
48 </script>
49 </head>
50 <body onload="runTest()">
51 WebGL should trigger GPU process launch if it is allowed.
52 <canvas id="da-canvas" width="10" height="10"></canvas>
53 </body>
54 </html>