Index: content/test/data/gpu/pixel_offscreenCanvas_commit_frameless_doc.html |
diff --git a/content/test/data/gpu/pixel_offscreenCanvas_commit_frameless_doc.html b/content/test/data/gpu/pixel_offscreenCanvas_commit_frameless_doc.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bd67623945dc56b86fe9d917602c95ea53110830 |
--- /dev/null |
+++ b/content/test/data/gpu/pixel_offscreenCanvas_commit_frameless_doc.html |
@@ -0,0 +1,58 @@ |
+<!DOCTYPE HTML> |
+ |
+<!-- READ BEFORE UPDATING: |
+If this test is updated make sure to increment the "revision" value of the |
+associated test in content/test/gpu/gpu_tests/pixel_test_pages.py. This will ensure |
+that the baseline images are regenerated on the next run. |
+--> |
+ |
+<html> |
+<head> |
+<title>OffscreenCanvas commit() for a frameless canvas : Blank page</title> |
+<style type="text/css"> |
+.nomargin { |
+ margin: 0px auto; |
+} |
+</style> |
+</head> |
+<body onload="main()"> |
+<div style="position:relative; width:50px; height:50px; background-color:white"> |
+</div> |
+<script> |
+var g_swapsBeforeAck = 15; |
+ |
+function main() |
+{ |
+ // This test aims to ensure that OffscreenCanvas.commit() does not |
+ // crash for a placeholder canvas under frameless document. |
+ // Since the document is invisible, the resultant image should be |
+ // not visible too. |
+ // TODO(crbug.com/683172): Modify this test after handling for |
+ // frameless canvas is done. |
+ var framelessDoc = document.implementation.createHTMLDocument("frameless"); |
+ var canvas = framelessDoc.createElement("canvas"); |
+ canvas.width = 50; |
+ canvas.height = 50; |
+ var offscreenCanvas = canvas.transferControlToOffscreen(); |
+ var ctx = offscreenCanvas.getContext("2d"); |
+ ctx.fillStyle = "blue"; |
+ ctx.fillRect(0, 0, 50, 50); |
+ ctx.commit(); |
+ |
+ waitForFinish(); |
+} |
+ |
+function waitForFinish() |
+{ |
+ if (g_swapsBeforeAck == 0) { |
+ domAutomationController.setAutomationId(1); |
+ domAutomationController.send("SUCCESS"); |
+ } else { |
+ g_swapsBeforeAck--; |
+ document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; |
+ window.requestAnimationFrame(waitForFinish); |
+ } |
+} |
+</script> |
+</body> |
+</html> |