Index: content/test/data/gpu/pixel_offscreenCanvas_webgl_resize.html |
diff --git a/content/test/data/gpu/pixel_offscreenCanvas_webgl_resize.html b/content/test/data/gpu/pixel_offscreenCanvas_webgl_resize.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a45e969c1f3f3047381a91c4927dfd37a817a4bf |
--- /dev/null |
+++ b/content/test/data/gpu/pixel_offscreenCanvas_webgl_resize.html |
@@ -0,0 +1,75 @@ |
+<!DOCTYPE HTML> |
Ken Russell (switch to Gerrit)
2016/12/20 06:01:24
Similar comment: ...resize_on_worker?
|
+ |
+<!-- READ BEFORE UPDATING: |
+If this test is updated make sure to increment the "revision" value of the |
+associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure |
Ken Russell (switch to Gerrit)
2016/12/20 06:01:24
Same fix here.
|
+that the baseline images are regenerated on the next run. |
+--> |
+ |
+<html> |
+<head> |
+<title>OffscreenCanvas 2d commit flow with resizing: 100X200 canvas as a result.</title> |
+<style type="text/css"> |
+.nomargin { |
+ margin: 0px auto; |
+} |
+</style> |
+<script id="myWorker" type="text/worker"> |
+self.onmessage = function(e) { |
+ var transfered = e.data; |
+ var gl = transfered.getContext('webgl'); |
+ gl.clearColor(0, 1, 0, 1); |
+ gl.clear(gl.COLOR_BUFFER_BIT); |
+ gl.commit(); |
+ |
+ // Resize offscreenCanvas from 150X150 to 100X200. |
+ transfered.width = 100; |
+ transfered.height = 200; |
+ gl.clearColor(0, 0, 1, 1); |
+ gl.clear(gl.COLOR_BUFFER_BIT); |
+ gl.commit(); |
+ |
+ self.postMessage(""); |
+}; |
+</script> |
+<script> |
+var g_swapsBeforeAck = 15; |
+ |
+function makeWorker(script) |
+{ |
+ var blob = new Blob([script]); |
+ return new Worker(URL.createObjectURL(blob)); |
+} |
+ |
+function waitForFinish() |
+{ |
+ if (g_swapsBeforeAck == 0) { |
+ domAutomationController.setAutomationId(1); |
+ domAutomationController.send("SUCCESS"); |
+ } else { |
+ g_swapsBeforeAck--; |
+ document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; |
+ window.webkitRequestAnimationFrame(waitForFinish); |
+ } |
+} |
+ |
+function main() |
+{ |
+ var canvas2D = document.getElementById("c"); |
+ var offscreenCanvas = canvas2D.transferControlToOffscreen(); |
+ var worker = makeWorker(document.getElementById("myWorker").textContent); |
+ worker.postMessage(offscreenCanvas, [offscreenCanvas]); |
+ worker.onmessage = function (e) { |
Ken Russell (switch to Gerrit)
2016/12/20 06:01:24
Same race question here.
|
+ waitForFinish(); |
+ }; |
+} |
+</script> |
+</head> |
+<body onload="main()"> |
+<div style="position:relative; width:200px; height:200px; background-color:white"> |
+</div> |
+<div id="container" style="position:absolute; top:0px; left:0px"> |
+<canvas id="c" width="150" height="150" class="nomargin"></canvas> |
+</div> |
+</body> |
+</html> |