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

Unified Diff: LayoutTests/fast/canvas/canvas-createImageBitmap-webgl.html

Issue 776293002: Window.createImageBitmap(HTMLCanvasElement) should copy the front buffer of WebGL, not back buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-createImageBitmap-webgl-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-createImageBitmap-webgl-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698