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

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

Issue 766333003: canvas: fix bugs on HTMLCanvasElement::copiedImage() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: drop vector 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
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..cb8cb51cd0fceb42ef47517a8122fa0d15a6264f 100644
--- a/LayoutTests/fast/canvas/canvas-createImageBitmap-webgl.html
+++ b/LayoutTests/fast/canvas/canvas-createImageBitmap-webgl.html
@@ -3,7 +3,14 @@
<script src="../../resources/js-test.js"></script>
</head>
<body onload="start();">
+<canvas id="webgl" width="200" height="200"></canvas>
<script>
+/*
+ * crbug.com/438986
+ * window.createImageBitmap(HTMLCanvasElement) copies the back buffer of WebGL.
+ * So createImageBitmap(HTMLCanvasElement) must create transparent ImageBuffer
+ * 1 frame after WebGL draws contents.
+ */
window.jsTestIsAsync = true;
var canvas = document.createElement("canvas");
@@ -19,23 +26,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. It must fail.")
Ken Russell (switch to Gerrit) 2014/12/11 01:35:56 Please rephrase this test so that the expectations
+ var webgl_canvas = document.getElementById("webgl");
+ createImageBitmapAndCheck(webgl_canvas).then(function() {
+ finishJSTest();
+ });
+ }
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698