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

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

Issue 1862033002: Make OffscreenCanvas Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no need to register, taking the same approach as extractTransferables Created 4 years, 8 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: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html
new file mode 100644
index 0000000000000000000000000000000000000000..9250720809a7e0c2f081a90275ef11ed189f554f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+
+description("Test OffscreenCanvas transferable with exception cases.");
+window.jsTestIsAsync = true;
+
+var worker = new Worker('./resources/OffscreenCanvas-transferable.js');
+
+var width = 50;
+var height = 50;
+var offscreenCanvas1 = new OffscreenCanvas(width, height);
+
+var ctx;
+shouldNotThrow("ctx = offscreenCanvas1.getContext('2d')");
+shouldBeType("ctx", "OffscreenCanvasRenderingContext2D");
+try {
+ worker.postMessage({data: offscreenCanvas1}, [offscreenCanvas1]);
+ testFailed("Transfer an offscreenCanvas with a context succeed, expected to fail");
+} catch(e) {
+ testPassed("Transfer an offscreenCanvas with a context should throw an exception: " + e);
+}
+
+var offscreenCanvas2 = new OffscreenCanvas(width, height);
+worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2]);
+try {
+ var image = offscreenCanvas2.transferToImageBitmap();
+ testFailed("Calling transferToImageBitmap from a neutered offscreenCanvas succeed, expected to fail");
+} catch(e) {
+ testPassed("Calling transferToImageBitmap from a neutered offscreenCanvas should throw an exception: " + e);
+}
+
+try {
+ worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2]);
+ testFailed("Transfer a neutered offscreenCanvas succeed, expected to fail");
+} catch(e) {
+ testPassed("Transfer a neutered offscreenCanvas should throw an exception: " + e);
+}
+
+try {
+ var ctx = offscreenCanvas2.getContext('2d');
+ testFailed("Calling getContext('2d') from a neutered offscreenCanvas succeed, expected to fail");
+} catch(e) {
+ testPassed("Calling getContext('2d') from a neutered offscreenCanvas should throw an exception: " + e);
+}
+
+finishJSTest();
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698