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

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

Issue 2359263002: Fix a gpu pixel test for WebGL's commit() API (Closed)
Patch Set: main thread wait for worker to send back msg Created 4 years, 2 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/page_sets/pixel_tests.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>OffscreenCanvas commit flow on worker thread: red square on white backgro und.</title> 11 <title>OffscreenCanvas commit flow on worker thread: red square on white backgro und.</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 <script id="myWorker" type="text/worker"> 17 <script id="myWorker" type="text/worker">
18 self.onmessage = function(e) { 18 self.onmessage = function(e) {
19 var transferredOffscreenCanvas = e.data; 19 var transferredOffscreenCanvas = e.data;
20 var gl = transferredOffscreenCanvas.getContext("webgl"); 20 var gl = transferredOffscreenCanvas.getContext("webgl");
21 gl.clearColor(1.0, 0.0, 0.0, 1.0); 21 gl.clearColor(1.0, 0.0, 0.0, 1.0);
22 gl.clear(gl.COLOR_BUFFER_BIT); 22 gl.clear(gl.COLOR_BUFFER_BIT);
23 gl.commit(); 23 gl.commit();
24 self.postMessage("");
24 }; 25 };
25 </script> 26 </script>
26 <script> 27 <script>
27 var g_swapsBeforeAck = 15; 28 var g_swapsBeforeAck = 15;
28 29
29 function makeWorker(script) { 30 function makeWorker(script) {
30 var blob = new Blob([script]); 31 var blob = new Blob([script]);
31 return new Worker(URL.createObjectURL(blob)); 32 return new Worker(URL.createObjectURL(blob));
32 } 33 }
33 34
34 function main() 35 function main()
35 { 36 {
36 draw(); 37 draw();
37 waitForFinish();
38 } 38 }
39 39
40 function draw() 40 function draw()
41 { 41 {
42 var canvas = document.getElementById("c"); 42 var canvas = document.getElementById("c");
43 var offscreenCanvas = canvas.transferControlToOffscreen(); 43 var offscreenCanvas = canvas.transferControlToOffscreen();
44 var worker = makeWorker(document.getElementById("myWorker").textContent); 44 var worker = makeWorker(document.getElementById("myWorker").textContent);
45 worker.postMessage(offscreenCanvas, [offscreenCanvas]); 45 worker.postMessage(offscreenCanvas, [offscreenCanvas]);
46 worker.onmessage = function (e) {
47 waitForFinish();
48 }
46 } 49 }
47 50
48 function waitForFinish() 51 function waitForFinish()
49 { 52 {
50 if (g_swapsBeforeAck == 0) { 53 if (g_swapsBeforeAck == 0) {
51 domAutomationController.setAutomationId(1); 54 domAutomationController.setAutomationId(1);
52 domAutomationController.send("SUCCESS"); 55 domAutomationController.send("SUCCESS");
53 } else { 56 } else {
54 g_swapsBeforeAck--; 57 g_swapsBeforeAck--;
55 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; 58 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1;
56 window.webkitRequestAnimationFrame(waitForFinish); 59 window.webkitRequestAnimationFrame(waitForFinish);
57 } 60 }
58 } 61 }
59 </script> 62 </script>
60 </head> 63 </head>
61 <body onload="main()"> 64 <body onload="main()">
62 <div style="position:relative; width:200px; height:200px; background-color:white "> 65 <div style="position:relative; width:200px; height:200px; background-color:white ">
63 </div> 66 </div>
64 <div id="container" style="position:absolute; top:0px; left:0px"> 67 <div id="container" style="position:absolute; top:0px; left:0px">
65 <canvas id="c" width="200" height="200" class="nomargin"></canvas> 68 <canvas id="c" width="200" height="200" class="nomargin"></canvas>
66 </div> 69 </div>
67 </body> 70 </body>
68 </html> 71 </html>
OLDNEW
« no previous file with comments | « no previous file | content/test/gpu/page_sets/pixel_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698