Index: LayoutTests/fast/canvas/canvas-createImageBitmap-webgl.html |
diff --git a/LayoutTests/fast/canvas/canvas-createImageBitmap-webgl.html b/LayoutTests/fast/canvas/canvas-createImageBitmap-webgl.html |
index 5d919c3f7673d88773836f7b5ab69c3cc60cb4b1..4d20701f5e152cb177ed43643e72ea76e0cd6a29 100644 |
--- a/LayoutTests/fast/canvas/canvas-createImageBitmap-webgl.html |
+++ b/LayoutTests/fast/canvas/canvas-createImageBitmap-webgl.html |
@@ -3,7 +3,12 @@ |
<script src="../../resources/js-test.js"></script> |
</head> |
<body onload="start();"> |
+<canvas id="webgl" width="200" height="200"></canvas> |
<script> |
+/* |
+ * window.createImageBitmap(HTMLCanvasElement) copies the front buffer of WebGL. |
+ * crbug.com/438986 |
+ */ |
window.jsTestIsAsync = true; |
var canvas = document.createElement("canvas"); |
@@ -19,23 +24,39 @@ |
} |
function start() { |
- var aCanvas = document.createElement("canvas"); |
- aCanvas.width = 200; |
- aCanvas.height = 200; |
- var gl = aCanvas.getContext("webgl"); |
+ debug("Check the imageBitmap of webgl.") |
+ var webgl_canvas = document.getElementById("webgl"); |
+ var gl = webgl_canvas.getContext("webgl", {preserveDrawingBuffer: false}); |
gl.clearColor(0.0, 1.0, 0.0, 1.0); |
gl.clear(gl.COLOR_BUFFER_BIT); |
+ createImageBitmapAndCheck(webgl_canvas).then(function() { |
+ if (window.testRunner) { |
+ testRunner.displayAsyncThen(asyncTest); |
+ } else { |
+ window.requestAnimationFrame(asyncTest); |
+ } |
+ }); |
+ } |
- createImageBitmap(aCanvas).then(function (imageBitmap) { |
+ function createImageBitmapAndCheck(webgl_canvas) { |
+ return createImageBitmap(webgl_canvas).then(function (imageBitmap) { |
+ ctx.clearRect(0, 0, 200, 200); |
ctx.drawImage(imageBitmap, 0, 0); |
shouldBeGreen(50, 50); |
shouldBeGreen(150, 150); |
- finishJSTest(); |
}, function() { |
testFailed("Promise was rejected."); |
finishJSTest(); |
}); |
} |
+ |
+ function asyncTest() { |
+ debug("Check the imageBitmap of webgl in the next frame.") |
+ var webgl_canvas = document.getElementById("webgl"); |
+ createImageBitmapAndCheck(webgl_canvas).then(function() { |
+ finishJSTest(); |
+ }); |
+ } |
</script> |
</body> |
</html> |