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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <script src="../../resources/js-test.js"></script>
4 <body>
5 <script id="myWorker" type="text/worker">
6 self.onmessage = function(e) {
7 var aCanvas = new OffScreenCanvas(50, 50);
8 self.postMessage({version:'first', width:aCanvas.width, height:aCanvas.height} );
9
10 aCanvas.width = 100;
11 aCanvas.height = 100;
12 self.postMessage({version:'second', width:aCanvas.width, height:aCanvas.height });
13 };
14 </script>
15
16 <script>
17 jsTestIsAsync = true;
18 description("Tests that the OffScreenCanvas can be constructed on a worker threa d.");
19
20 var width;
21 var height;
22
23 function makeWorker(script) {
24 var blob = new Blob([script]);
25 return new Worker(URL.createObjectURL(blob));
26 }
27
28 function handleMessageFromWorker(msg) {
29 width = msg.data.width;
30 height = msg.data.height;
31 switch (msg.data.version) {
32 case 'first':
33 shouldBe('width', '50');
34 shouldBe('height', '50');
35 break;
36 case 'second':
37 shouldBe('width', '100');
38 shouldBe('height', '100');
39 finishJSTest();
40 break;
41 default:
42 testFailed("Unexpected failure");
43 break;
44 }
45 }
46
47 var worker = makeWorker(document.getElementById('myWorker').textContent);
48 worker.addEventListener('message', handleMessageFromWorker);
49 worker.postMessage("");
50 </script>
51
52 </body>
53 </html>
OLDNEW
« 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