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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-placeholder-createImageBitmap.html

Issue 2506043002: Allow ImageBitmap objects to be created from placeholder canvases. (Closed)
Patch Set: add test Created 4 years, 1 month 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/Source/core/frame/ImageBitmap.cpp » ('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 <head>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 </head>
7 <body>
8 <script>
9 async_test(function(t) {
10 var canvas = document.createElement('canvas');
11 var offscreen = canvas.transferControlToOffscreen();
12 var ctx = offscreen.getContext('2d');
13 ctx.fillStyle = '#0f0';
14 ctx.fillRect(0, 0, canvas.width, canvas.height);
15 ctx.commit();
16
17 var testCanvas = document.createElement('canvas');
18 var testCtx = testCanvas.getContext('2d');
19
20 createImageBitmap(canvas).then(image => {
21 testCtx.drawImage(image, 0, 0);
22 t.step( function() {
23 var pixel = testCtx.getImageData(0, 0, 1, 1).data;
24 var expectedValue = [0, 0, 0, 0]; // pixel is blank because commit() is as ync
25 assert_array_equals(pixel, expectedValue, "Verify that commit() is not syn chronous.");
26 });
27
28 // The call to setTimeout acts as a synchronization barrier to guarantee tha t
29 // the commit has propagated.
30 setTimeout(function() {
31 createImageBitmap(canvas).then(image => {
32 testCtx.drawImage(image, 0, 0);
33 t.step( function() {
34 var pixel = testCtx.getImageData(0, 0, 1, 1).data;
35 var expectedValue = [0, 255, 0, 255];
36 assert_array_equals(pixel, expectedValue, "Verify that async update of placeholder propagated through createImageData");
37 });
38 t.done();
39 });
40 }, 0);
41 });
42 }, "Test whether createImageBitmap on a placeholder canvas captures the image co mmitted to the associated OffscreenCanvas.");
43 </script>
44 </body>
45 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698