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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-MessageChannel-transfer.html

Issue 2572793002: Test OffscreenCanvas transfer via MessageChannel (Closed)
Patch Set: Created 4 years 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 | no next file » | 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 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 async_test(t => {
6 var channel = new MessageChannel();
7 var canvas = document.createElement('canvas');
8 canvas.width = canvas.height = 10;
9 var offscreen = canvas.transferControlToOffscreen();
10 channel.port2.onmessage = function(message) {
11 var ctx = message.data.getContext('2d');
12 ctx.fillStyle = '#0f0';
13 ctx.fillRect(0, 0, 10, 10);
14 ctx.commit();
15 setTimeout(function() { // synchronization barrier to allow commit to propag ate
16 var canvas2 = document.createElement('canvas');
17 canvas2.width = canvas2.height = 10;
18 var ctx2 = canvas2.getContext('2d');
19 ctx2.drawImage(canvas, 0, 0);
20 var pixel = ctx2.getImageData(0, 0, 1, 1).data;
21 t.step(function() {
22 assert_array_equals(pixel, [0, 255, 0, 255]);
23 });
24 t.done();
25 }, 0);
26 }
27 channel.port1.postMessage(offscreen, [offscreen]);
28 }, "Verify that posting an OffscreenCanvas through a MessageChannel works as int ended.");
29
30 test(function() {
31 var channel = new MessageChannel();
32 var canvas = document.createElement('canvas');
33 canvas.width = canvas.height = 10;
34 var offscreen = canvas.transferControlToOffscreen();
35 channel.port2.onmessage = function() {};
36 assert_throws("DataCloneError", function() {channel.port1.postMessage(offscree n)});
37 }, "Verify that cloning an OffscreenCanvas through a MessageChannel throws an ex ception")
38
39 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698