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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-constructor-in-worker.html

Issue 1565673002: Expose Offscreencanvas to worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no separate js for worker Created 4 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-constructor-in-worker-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/OffScreenCanvas-constructor-in-worker-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698