| Index: third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-invalid-args-in-worker.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-invalid-args-in-worker.html b/third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-invalid-args-in-worker.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ed5506381fb00f5f7b7220c7893e2c9dfdfa81c1
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-invalid-args-in-worker.html
|
| @@ -0,0 +1,57 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<script src="../../resources/js-test.js"></script>
|
| +<body>
|
| +<script id="myWorker" type="text/worker">
|
| +var setWidth = Math.pow(2, 31);
|
| +var setHeight = Math.pow(2, 31);
|
| +
|
| +self.onmessage = function(e) {
|
| + var canvas1 = new OffScreenCanvas(setWidth, setHeight);
|
| + self.postMessage({version:'canvas1', width:canvas1.width, height:canvas1.height});
|
| +
|
| + var canvas2 = new OffScreenCanvas(null, null);
|
| + self.postMessage({version:'canvas2', width:canvas2.width, height:canvas2.height});
|
| +};
|
| +</script>
|
| +
|
| +<script>
|
| +jsTestIsAsync = true;
|
| +description("Tests that the OffScreenCanvas can handle invalid arguments on a worker");
|
| +
|
| +var width;
|
| +var height;
|
| +var setWidth = Math.pow(2, 31);
|
| +var setHeight = Math.pow(2, 31);
|
| +
|
| +function makeWorker(script) {
|
| + var blob = new Blob([script]);
|
| + return new Worker(URL.createObjectURL(blob));
|
| +}
|
| +
|
| +function handleMessageFromWorker(msg) {
|
| + width = msg.data.width;
|
| + height = msg.data.height;
|
| + switch (msg.data.version) {
|
| + case 'canvas1':
|
| + shouldBe('width', 'setWidth-1');
|
| + shouldBe('height', 'setHeight-1');
|
| + break;
|
| + case 'canvas2':
|
| + shouldBe('width', '0');
|
| + shouldBe('height', '0');
|
| + finishJSTest();
|
| + break;
|
| + default:
|
| + testFailed("Unexpected failure");
|
| + break;
|
| + }
|
| +}
|
| +
|
| +var worker = makeWorker(document.getElementById('myWorker').textContent);
|
| +worker.addEventListener('message', handleMessageFromWorker);
|
| +worker.postMessage("");
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|