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

Unified Diff: LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js

Issue 16032003: Fixing Canvas2DLayerBridge to handle lost graphics contexts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added Layout test and necessary content_shell API to test context loss Created 7 years, 6 months 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/script-tests/canvas-lost-gpu-context.js
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js b/LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js
new file mode 100644
index 0000000000000000000000000000000000000000..34a8724d41500bda62df6868d8206d1d96e46b8d
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/canvas-lost-gpu-context.js
@@ -0,0 +1,22 @@
+description("Test the behavior of canvas recovery after a gpu context loss");
+
+if (window.internals && window.testRunner) {
+ window.testRunner.dumpAsText();
+ var ctx = document.createElement('canvas').getContext('2d');
+ document.body.appendChild(ctx.canvas);
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
+ // context loss is a no-op when not gpu-acelerated, which is fine for this test
+ window.internals.loseSharedGraphicsContext3D();
Stephen White 2013/06/18 18:06:57 I wonder if we should do this four times, to test
+ //Verify that buffer automatically recovers to a usable state
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
+ imageData = ctx.getImageData(0, 0, 1, 1);
+ imgdata = imageData.data;
+ shouldBe("imgdata[0]", "0");
+ shouldBe("imgdata[1]", "255");
+ shouldBe("imgdata[2]", "0");
+ shouldBe("imgdata[3]", "255");
+} else {
+ testFailed('This test requires window.internals and window.testRunner.');
+}
« no previous file with comments | « LayoutTests/fast/canvas/canvas-lost-gpu-context-expected.txt ('k') | Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698