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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-zero-size-readback.html

Issue 2539333003: Fix crash when calling convertToBlob on an OffscreenCanvas with no pixels (Closed)
Patch Set: remove tab characters Created 4 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 | third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-zero-size-readback.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-zero-size-readback.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-zero-size-readback.html
new file mode 100644
index 0000000000000000000000000000000000000000..c9acf3a21bd6e0fdb7cb50cd5d296cbfea8079f6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-zero-size-readback.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+promise_test(
+ t => { return zeroSizeReadback("width", "none", t); },
+ "Verify convertToBlob on a 0 width OffscreenCanvas with no context."
+);
+
+promise_test(
+ t => { return zeroSizeReadback("width", "2d", t); },
+ "Verify convertToBlob and getImageData on a 0 width OffscreenCanvas with a 2d context."
+);
+
+promise_test(
+ t => { return zeroSizeReadback("width", "webgl", t); },
+ "Verify convertToBlob on a 0 width OffscreenCanvas with a webgl context."
+);
+
+promise_test(
+ t => { return zeroSizeReadback("width", "webgl2", t); },
+ "Verify convertToBlob on a 0 width OffscreenCanvas with a webgl2 context."
+);
+
+promise_test(
+ t => { return zeroSizeReadback("height", "none", t); },
+ "Verify convertToBlob on a 0 height OffscreenCanvas with no context."
+);
+
+promise_test(
+ t => { return zeroSizeReadback("height", "2d", t); },
+ "Verify convertToBlob and getImageData on a 0 height OffscreenCanvas with a 2d context."
+);
+
+promise_test(
+ t => { return zeroSizeReadback("height", "webgl", t); },
+ "Verify convertToBlob on a 0 height OffscreenCanvas with a webgl context."
+);
+
+promise_test(
+ t => { return zeroSizeReadback("height", "webgl2", t); },
+ "Verify convertToBlob on a 0 height OffscreenCanvas with a webgl2 context."
+);
+
+function zeroSizeReadback(zeroDimension, contextType, t) {
+ var offscreen = new OffscreenCanvas(10, 10);
+ eval("offscreen." + zeroDimension + " = 0");
+ // Verify that one of the dimensions was indeed zeroed.
+ assert_equals(offscreen.width * offscreen.height, 0);
+
+ var ctx;
+ if (contextType != "none") {
+ ctx = offscreen.getContext(contextType);
+ }
+
+ if (contextType == '2d') {
+ var imgdata = ctx.getImageData(0, 0, 1, 1);
+ assert_equals(imgdata.width, 1);
+ assert_equals(imgdata.height, 1);
+ }
+
+ return promise_rejects(t, new DOMException('', 'IndexSizeError'), offscreen.convertToBlob());
+}
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698