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

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

Issue 2738773004: No longer clamp setTimeout(..., 0) to 1ms. (Closed)
Patch Set: update webgl2 conformance expectations as well Created 3 years, 8 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
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/testharness.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script> 5 <script src="../../resources/testharnessreport.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <script> 8 <script>
9 async_test(function(t) { 9 async_test(function(t) {
10 var canvas = document.createElement('canvas'); 10 var canvas = document.createElement('canvas');
11 var offscreen = canvas.transferControlToOffscreen(); 11 var offscreen = canvas.transferControlToOffscreen();
12 var ctx = offscreen.getContext('2d'); 12 var ctx = offscreen.getContext('2d');
13 ctx.fillStyle = '#0f0'; 13 ctx.fillStyle = '#0f0';
14 ctx.fillRect(0, 0, canvas.width, canvas.height); 14 ctx.fillRect(0, 0, canvas.width, canvas.height);
15 ctx.commit(); 15 ctx.commit();
16 16
17 var testCanvas = document.createElement('canvas'); 17 var testCanvas = document.createElement('canvas');
18 var testCtx = testCanvas.getContext('2d'); 18 var testCtx = testCanvas.getContext('2d');
19 19
20 createImageBitmap(canvas).then(image => { 20 createImageBitmap(canvas).then(image => {
21 testCtx.drawImage(image, 0, 0); 21 testCtx.drawImage(image, 0, 0);
22 t.step( function() { 22 t.step( function() {
23 var pixel = testCtx.getImageData(0, 0, 1, 1).data; 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 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."); 25 assert_array_equals(pixel, expectedValue, "Verify that commit() is not syn chronous.");
26 }); 26 });
27 27
28 // The call to setTimeout acts as a synchronization barrier to guarantee tha t 28 // TODO(junov): Use the Promise returned by commit to schedule after the
29 // the commit has propagated. 29 // commit. (crbug.com/709484)
30 setTimeout(function() { 30 setTimeout(function() {
31 createImageBitmap(canvas).then(image => { 31 setTimeout(function() {
32 testCtx.drawImage(image, 0, 0); 32 createImageBitmap(canvas).then(image => {
33 t.step( function() { 33 testCtx.drawImage(image, 0, 0);
34 var pixel = testCtx.getImageData(0, 0, 1, 1).data; 34 t.step( function() {
35 var expectedValue = [0, 255, 0, 255]; 35 var pixel = testCtx.getImageData(0, 0, 1, 1).data;
36 assert_array_equals(pixel, expectedValue, "Verify that async update of placeholder propagated through createImageData"); 36 var expectedValue = [0, 255, 0, 255];
37 assert_array_equals(pixel, expectedValue, "Verify that async update of placeholder propagated through createImageData");
38 });
39 t.done();
37 }); 40 });
38 t.done(); 41 }, 0);
39 });
40 }, 0); 42 }, 0);
41 }); 43 });
42 }, "Test whether createImageBitmap on a placeholder canvas captures the image co mmitted to the associated OffscreenCanvas."); 44 }, "Test whether createImageBitmap on a placeholder canvas captures the image co mmitted to the associated OffscreenCanvas.");
43 </script> 45 </script>
44 </body> 46 </body>
45 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698