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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html

Issue 2520973002: Fix a small error in exception handling in convertToBlob (Closed)
Patch Set: address comments. Created 4 years, 1 month 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/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-convertToBlob.html » ('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-convertToBlob-exceptions.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html
new file mode 100644
index 0000000000000000000000000000000000000000..03629b8f99d39c96c9f2cf9826200c3438b9fed4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script id="myWorker" type="text/worker">
+self.onmessage = function(e) {
+};
+</script>
+<script>
+
+function makeWorker(script)
+{
+ var blob = new Blob([script]);
+ return new Worker(URL.createObjectURL(blob));
+}
+
+async_test(function(t) {
+ var worker = makeWorker(document.getElementById("myWorker").textContent);
+ var offscreenCanvas = new OffscreenCanvas(10, 10);
+ worker.postMessage({offscreenCanvas}, [offscreenCanvas]);
+ offscreenCanvas.convertToBlob().then(t.step_func_done(function() {
+ assert_false("convertToBlob didn't throw, but should be");
+ }), t.step_func_done(function(e) {
+ assert_true(e instanceof DOMException);
+ assert_equals(e.name, "InvalidStateError");
+ }));
+}, "Test that call convertToBlob on a detached OffscreenCanvas throws exception");
+
+async_test(function(t) {
+ var offscreenCanvas = new OffscreenCanvas(0, 0);
+ offscreenCanvas.convertToBlob().then(t.step_func_done(function() {
+ assert_false("convertToBlob didn't throw, but should be");
+ }), t.step_func_done(function(e) {
+ assert_true(e instanceof DOMException);
+ assert_equals(e.name, "IndexSizeError");
+ }));
+}, "Test that call convertToBlob on a OffscreenCanvas with size 0 throws exception");
+
+</script>
+
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/cross-origin-OffscreenCanvas2D-convertToBlob.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698