Chromium Code Reviews| 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; |
|
sof
2016/04/26 19:37:15
It looks like you can avoid making this test async
xidachen
2016/04/26 20:40:58
Done.
|
| + |
| +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 { |
|
Justin Novosad
2016/04/26 20:08:31
make this simpler and more readable by using "shou
xidachen
2016/04/26 20:40:58
Done.
|
| + 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 { |
|
Justin Novosad
2016/04/26 20:08:31
shouldThrow
xidachen
2016/04/26 20:40:58
Done.
|
| + 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 { |
|
Justin Novosad
2016/04/26 20:08:31
shouldThrow
xidachen
2016/04/26 20:40:58
Done.
|
| + 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 { |
|
Justin Novosad
2016/04/26 20:08:31
shouldThrow
xidachen
2016/04/26 20:40:58
Done.
|
| + 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> |