OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript"> | 3 <script type="text/javascript"> |
4 var canvas; | 4 var canvas; |
5 var w, h; | 5 var w, h; |
6 var gl; | 6 var gl; |
7 var extension; | 7 var extension; |
8 | 8 |
9 var alreadySetAutomationId = false; | 9 var alreadySetAutomationId = false; |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 return array[0] == 255 && array[1] == 0 && | 28 return array[0] == 255 && array[1] == 0 && |
29 array[size - 4] == 0 && array[size - 3] == 255; | 29 array[size - 4] == 0 && array[size - 3] == 255; |
30 } | 30 } |
31 | 31 |
32 function testContextLost(e) { | 32 function testContextLost(e) { |
33 e.preventDefault(); | 33 e.preventDefault(); |
34 if (extension) { | 34 if (extension) { |
35 setTimeout(function() { | 35 setTimeout(function() { |
36 extension.restoreContext(); | 36 extension.restoreContext(); |
| 37 extension = null; |
37 }, 0); | 38 }, 0); |
38 } | 39 } |
39 } | 40 } |
40 | 41 |
41 function testContextRestored() { | 42 function testContextRestored() { |
42 gl = canvas.getContext("experimental-webgl"); | 43 gl = canvas.getContext("experimental-webgl"); |
43 if (!gl || gl.isContextLost()) { | 44 if (!gl || gl.isContextLost()) { |
44 // Might just be blocked because of infobar. | 45 // Might just be blocked because of infobar. |
45 return; | 46 return; |
46 } | 47 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 alreadySetAutomationId = true; | 79 alreadySetAutomationId = true; |
79 window.domAutomationController.send("LOADED"); | 80 window.domAutomationController.send("LOADED"); |
80 break; | 81 break; |
81 } | 82 } |
82 } | 83 } |
83 | 84 |
84 function onLoad() { | 85 function onLoad() { |
85 canvas = document.getElementById("canvas1"); | 86 canvas = document.getElementById("canvas1"); |
86 w = canvas.width; | 87 w = canvas.width; |
87 h = canvas.height; | 88 h = canvas.height; |
88 if (!canvas) { | 89 if (!canvas) |
89 document.title = "FAILED: canvas element not found"; | |
90 return; | 90 return; |
91 } | |
92 canvas.addEventListener("webglcontextlost", testContextLost, false); | 91 canvas.addEventListener("webglcontextlost", testContextLost, false); |
93 canvas.addEventListener("webglcontextrestored", testContextRestored, false); | 92 canvas.addEventListener("webglcontextrestored", testContextRestored, false); |
94 | 93 |
95 gl = canvas.getContext("experimental-webgl"); | 94 gl = canvas.getContext("experimental-webgl"); |
96 if (!gl) { | 95 if (!gl) |
97 document.title = "FAILED: could not get webgl context for canvas"; | |
98 return; | 96 return; |
99 } | |
100 | 97 |
101 if (!testHorizontalBands()) { | 98 if (!testHorizontalBands()) |
102 document.title = "FAILED: did not render correctly"; | |
103 return; | 99 return; |
104 } | |
105 | 100 |
106 var query = /query=(.*)/.exec(window.location.href); | 101 var query = /query=(.*)/.exec(window.location.href); |
107 if (query) { | 102 if (query) |
108 contextLostTest(query[1]); | 103 contextLostTest(query[1]); |
109 } else { | |
110 var renderer = gl.getParameter(gl.RENDERER); | |
111 document.title = "SUCCESS: " + renderer; | |
112 } | |
113 } | 104 } |
114 </script> | 105 </script> |
115 </head> | 106 </head> |
116 <body onload="onLoad()"> | 107 <body onload="onLoad()"> |
117 <canvas id="canvas1" width="16px" height="32px"> | 108 <canvas id="canvas1" width="16px" height="32px"> |
118 </canvas> | 109 </canvas> |
119 </body> | 110 </body> |
120 </html> | 111 </html> |
OLD | NEW |