Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320)
[chromium-blink-merge.git] / content / test / data / gpu / gpu_process_crash.html
bloba53e55c26cdf0f37bc630c695842eb3d0c44e434
1 <html>
2 <head>
3 <script type="text/javascript">
4 function onLoad() {
5 window.domAutomationController.reset = function() {
6 window.domAutomationController._loaded = false;
7 window.domAutomationController._succeeded = false;
8 window.domAutomationController._finished = false;
9 window.requestAnimationFrame(draw);
11 window.domAutomationController.send("LOADED");
14 function draw() {
15 // Render some WebGL into a fresh canvas to ensure the GPU process
16 // was created.
17 var canvas = document.createElement("canvas");
18 canvas.width = 32;
19 canvas.height = 32;
20 gl = canvas.getContext("webgl");
21 if (!gl) {
22 console.log("Failed to fetch WebGL context");
23 window.domAutomationController.send("FAILED");
24 return;
27 gl.clearColor(1, 0, 0, 1);
28 gl.clear(gl.COLOR_BUFFER_BIT);
29 var pixels = new Uint8Array(4);
30 gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
31 var tolerance = 1;
32 if (Math.abs(pixels[0] - 255) > tolerance ||
33 Math.abs(pixels[1] - 0) > tolerance ||
34 Math.abs(pixels[2] - 0) > tolerance ||
35 Math.abs(pixels[3] - 255) > tolerance) {
36 console.log("Expected (255, 0, 0, 255), got (" +
37 pixels[0] + ", " +
38 pixels[1] + ", " +
39 pixels[2] + ", " +
40 pixels[3] + ")");
41 window.domAutomationController.send("FAILED");
42 return;
45 window.domAutomationController.send("SUCCESS");
47 </script>
48 </head>
49 <body onload="onLoad()">
50 GPU process crash test running.
51 </body>
52 </html>