| Index: third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-constructor-in-worker.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-constructor-in-worker.html b/third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-constructor-in-worker.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..01df0f463bb7e4eb7eb96bab774b4913bac34e14
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-constructor-in-worker.html
|
| @@ -0,0 +1,53 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<script src="../../resources/js-test.js"></script>
|
| +<body>
|
| +<script id="myWorker" type="text/worker">
|
| +self.onmessage = function(e) {
|
| + var aCanvas = new OffScreenCanvas(50, 50);
|
| + self.postMessage({version:'first', width:aCanvas.width, height:aCanvas.height});
|
| +
|
| + aCanvas.width = 100;
|
| + aCanvas.height = 100;
|
| + self.postMessage({version:'second', width:aCanvas.width, height:aCanvas.height});
|
| +};
|
| +</script>
|
| +
|
| +<script>
|
| +jsTestIsAsync = true;
|
| +description("Tests that the OffScreenCanvas can be constructed on a worker thread.");
|
| +
|
| +var width;
|
| +var height;
|
| +
|
| +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 'first':
|
| + shouldBe('width', '50');
|
| + shouldBe('height', '50');
|
| + break;
|
| + case 'second':
|
| + shouldBe('width', '100');
|
| + shouldBe('height', '100');
|
| + finishJSTest();
|
| + break;
|
| + default:
|
| + testFailed("Unexpected failure");
|
| + break;
|
| + }
|
| +}
|
| +
|
| +var worker = makeWorker(document.getElementById('myWorker').textContent);
|
| +worker.addEventListener('message', handleMessageFromWorker);
|
| +worker.postMessage("");
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|