Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1336)

Side by Side Diff: content/test/data/gpu/pixel_canvas2d_webgl.html

Issue 1826343003: Add safety checks and reenable Canvas2D/WebGL trace_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/trace_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 2
3 <!-- READ BEFORE UPDATING: 3 <!-- READ BEFORE UPDATING:
4 If this test is updated make sure to increment the "revision" value of the 4 If this test is updated make sure to increment the "revision" value of the
5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure 5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure
6 that the baseline images are regenerated on the next run. 6 that the baseline images are regenerated on the next run.
7 --> 7 -->
8 8
9 <html> 9 <html>
10 <head> 10 <head>
11 <title>Accelerated Retina Canvas 2D and WebGL Test: Red Box and Green Triangle o ver Black Background</title> 11 <title>Accelerated Retina Canvas 2D and WebGL Test: Red Box and Green Triangle o ver Black Background</title>
12 <style type="text/css"> 12 <style type="text/css">
13 .nomargin { 13 .nomargin {
14 margin: 0px auto; 14 margin: 0px auto;
15 } 15 }
16 </style> 16 </style>
17 17
18 <script src="pixel_webgl_util.js"></script> 18 <script src="pixel_webgl_util.js"></script>
19 19
20 <script> 20 <script>
21 var g_swapsBeforeAck = 15; 21 var g_swapsBeforeAck = 15;
22 var gl; 22 var gl;
23 23
24 function main() 24 function main()
25 { 25 {
26 draw();
27 waitForFinish();
28 }
29
30 function draw()
31 {
32 var canvas = document.getElementById("c"); 26 var canvas = document.getElementById("c");
33 canvas.style.width = canvas.style.height = "150px"; 27 canvas.style.width = canvas.style.height = "150px";
34 var c2d = canvas.getContext("2d"); 28 var c2d = canvas.getContext("2d");
35 c2d.clearRect(0, 0, canvas.width, canvas.height); 29 c2d.clearRect(0, 0, canvas.width, canvas.height);
36 c2d.fillStyle = "rgba(255, 0, 0, 0.5)"; 30 c2d.fillStyle = "rgba(255, 0, 0, 0.5)";
37 c2d.fillRect(50, 50, 100, 100); 31 c2d.fillRect(50, 50, 100, 100);
38 32
39 var webglCanvas = document.getElementById("c2"); 33 var webglCanvas = document.getElementById("c2");
40 gl = initGL(webglCanvas); 34 gl = initGL(webglCanvas);
41 if (!setup(gl)) { 35 if (!gl) {
36 console.log('Failed to initialize GL from canvas: ' + webglCanvas);
42 domAutomationController.setAutomationId(1); 37 domAutomationController.setAutomationId(1);
43 domAutomationController.send("FAILURE"); 38 domAutomationController.send("FAILURE");
39 return;
44 } 40 }
41
42 if (!setup(gl)) {
43 console.log('Failed to set up GL: ' + gl);
44 domAutomationController.setAutomationId(1);
45 domAutomationController.send("FAILURE");
46 return;
47 }
48
49 waitForFinish();
45 } 50 }
46 51
47 function waitForFinish() 52 function waitForFinish()
48 { 53 {
49 if (g_swapsBeforeAck == 0) { 54 if (g_swapsBeforeAck == 0) {
50 domAutomationController.setAutomationId(1); 55 domAutomationController.setAutomationId(1);
51 domAutomationController.send("SUCCESS"); 56 domAutomationController.send("SUCCESS");
52 } else { 57 } else {
53 g_swapsBeforeAck--; 58 g_swapsBeforeAck--;
54 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; 59 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1;
55 drawTriangle(gl); 60 drawTriangle(gl);
56 window.webkitRequestAnimationFrame(waitForFinish); 61 window.webkitRequestAnimationFrame(waitForFinish);
57 } 62 }
58 } 63 }
59 </script> 64 </script>
60 </head> 65 </head>
61 <body onload="main()"> 66 <body onload="main()">
62 <div style="position:relative; width:400px; height:400px; background-color:black "> 67 <div style="position:relative; width:400px; height:400px; background-color:black ">
63 </div> 68 </div>
64 <div id="container" style="position:absolute; top:0px; left:0px"> 69 <div id="container" style="position:absolute; top:0px; left:0px">
65 <!-- 70 <!--
66 Canvas acceleration requires that the canvas be at least 256x257. 71 Canvas acceleration requires that the canvas be at least 256x257.
67 --> 72 -->
68 <canvas id="c" width="300" height="300" class="nomargin"></canvas> 73 <canvas id="c" width="300" height="300" class="nomargin"></canvas>
69 <canvas id="c2" width="300" height="300" class="nomargin"></canvas> 74 <canvas id="c2" width="300" height="300" class="nomargin"></canvas>
70 </div> 75 </div>
71 </body> 76 </body>
72 </html> 77 </html>
OLDNEW
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/trace_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698