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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 setInterval(function() { | 93 setInterval(function() { |
94 var garbageArray = new Uint8Array(1024 * 1024); | 94 var garbageArray = new Uint8Array(1024 * 1024); |
95 garbageArray[0] = 255; | 95 garbageArray[0] = 255; |
96 }, 10); | 96 }, 10); |
97 } | 97 } |
98 }; | 98 }; |
99 | 99 |
100 createAndDiscardContext(); | 100 createAndDiscardContext(); |
101 } | 101 } |
102 | 102 |
| 103 function getLoseContextExtension() |
| 104 { |
| 105 return gl.getExtension("WEBKIT_WEBGL_lose_context") || |
| 106 gl.getExtension("WEBGL_lose_context"); |
| 107 } |
| 108 |
| 109 function loseContextUsingExtension() |
| 110 { |
| 111 getLoseContextExtension().loseContext(); |
| 112 // Report success at the next frame to give the compositor a chance to draw |
| 113 // using the lost context. |
| 114 window.requestAnimationFrame(function() { |
| 115 window.domAutomationController.send("SUCCESS"); |
| 116 }); |
| 117 } |
| 118 |
103 function contextLostTest(kind) | 119 function contextLostTest(kind) |
104 { | 120 { |
105 switch (kind) { | 121 switch (kind) { |
106 case "WEBGL_lose_context": { | 122 case "WEBGL_lose_context": { |
107 extension = gl.getExtension("WEBKIT_WEBGL_lose_context") || | 123 extension = getLoseContextExtension(); |
108 gl.getExtension("WEBGL_lose_context"); | |
109 extension.loseContext(); | 124 extension.loseContext(); |
110 break; | 125 break; |
111 } | 126 } |
112 case "kill": | 127 case "kill": |
113 // nothing -- the browser test navigates to about:gpucrash and kills | 128 // nothing -- the browser test navigates to about:gpucrash and kills |
114 // the GPU process. | 129 // the GPU process. |
115 break; | 130 break; |
116 case "kill_after_notification": | 131 case "kill_after_notification": |
117 // The browser test waits for notification from the page that it | 132 // The browser test waits for notification from the page that it |
118 // has been loaded before navigating to about:gpucrash. | 133 // has been loaded before navigating to about:gpucrash. |
(...skipping 30 matching lines...) Expand all Loading... |
149 if (query) | 164 if (query) |
150 contextLostTest(query[1]); | 165 contextLostTest(query[1]); |
151 } | 166 } |
152 </script> | 167 </script> |
153 </head> | 168 </head> |
154 <body onload="onLoad()"> | 169 <body onload="onLoad()"> |
155 <canvas id="canvas1" width="16px" height="32px"> | 170 <canvas id="canvas1" width="16px" height="32px"> |
156 </canvas> | 171 </canvas> |
157 </body> | 172 </body> |
158 </html> | 173 </html> |
OLD | NEW |