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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8
9 description("Test OffscreenCanvas transferable with exception cases.");
10 window.jsTestIsAsync = true;
11
12 var worker = new Worker('./resources/OffscreenCanvas-transferable.js');
13
14 var width = 50;
15 var height = 50;
16 var offscreenCanvas1 = new OffscreenCanvas(width, height);
17
18 var ctx;
19 shouldNotThrow("ctx = offscreenCanvas1.getContext('2d')");
20 shouldBeType("ctx", "OffscreenCanvasRenderingContext2D");
21 try {
22 worker.postMessage({data: offscreenCanvas1}, [offscreenCanvas1]);
23 testFailed("Transfer an offscreenCanvas with a context succeed, expected to fail");
24 } catch(e) {
25 testPassed("Transfer an offscreenCanvas with a context should throw an excep tion: " + e);
26 }
27
28 var offscreenCanvas2 = new OffscreenCanvas(width, height);
29 worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2]);
30 try {
31 var image = offscreenCanvas2.transferToImageBitmap();
32 testFailed("Calling transferToImageBitmap from a neutered offscreenCanvas su cceed, expected to fail");
33 } catch(e) {
34 testPassed("Calling transferToImageBitmap from a neutered offscreenCanvas sh ould throw an exception: " + e);
35 }
36
37 try {
38 worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2]);
39 testFailed("Transfer a neutered offscreenCanvas succeed, expected to fail");
40 } catch(e) {
41 testPassed("Transfer a neutered offscreenCanvas should throw an exception: " + e);
42 }
43
44 try {
45 var ctx = offscreenCanvas2.getContext('2d');
46 testFailed("Calling getContext('2d') from a neutered offscreenCanvas succeed , expected to fail");
47 } catch(e) {
48 testPassed("Calling getContext('2d') from a neutered offscreenCanvas should throw an exception: " + e);
49 }
50
51 finishJSTest();
52 </script>
53 </body>
54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698