| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script> | 4 <script> |
| 5 // This test aims to ensure that OffscreenCanvas.commit() does not | 5 // This test aims to ensure that OffscreenCanvas.commit() does not |
| 6 // crash for a placeholder canvas under frameless document. | 6 // crash for a placeholder canvas under frameless document. |
| 7 // Since the document is invisible, the resultant image should be | 7 // Since the document is invisible, the resultant image should be |
| 8 // not visible too. But users must be able to draw to the OffscreenCanvas | 8 // not visible too. But users must be able to draw to the OffscreenCanvas |
| 9 // and do canvas-operations on the frameless placeholder canvas. | 9 // and do canvas-operations on the frameless placeholder canvas. |
| 10 // TODO(crbug.com/683172): Modify this test after handling for | 10 // TODO(crbug.com/683172): Modify this test after handling for |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 }, "Verify that the getImageData() works on the OffscreenCanvas context of a fra
meless canvas"); | 34 }, "Verify that the getImageData() works on the OffscreenCanvas context of a fra
meless canvas"); |
| 35 | 35 |
| 36 async_test(function(t) { | 36 async_test(function(t) { |
| 37 var canvas = createFramelessCanvas(); | 37 var canvas = createFramelessCanvas(); |
| 38 var offscreenCanvas = transferControlAndCommit(canvas); | 38 var offscreenCanvas = transferControlAndCommit(canvas); |
| 39 | 39 |
| 40 var c = document.createElement("canvas"); | 40 var c = document.createElement("canvas"); |
| 41 c.width = 50; | 41 c.width = 50; |
| 42 c.height = 50; | 42 c.height = 50; |
| 43 var ctx2 = c.getContext("2d"); | 43 var ctx2 = c.getContext("2d"); |
| 44 // TODO(junov): Use the Promise returned by commit to schedule after the |
| 45 // commit. (crbug.com/709484) |
| 44 setTimeout(function() { | 46 setTimeout(function() { |
| 45 ctx2.drawImage(canvas, 0, 0); | 47 setTimeout(function() { |
| 46 var pixels = ctx2.getImageData(0, 0, 1, 1).data; | 48 ctx2.drawImage(canvas, 0, 0); |
| 47 t.step(function() { | 49 var pixels = ctx2.getImageData(0, 0, 1, 1).data; |
| 48 assert_array_equals(pixels, [0, 0, 255, 255]); | 50 t.step(function() { |
| 49 }); | 51 assert_array_equals(pixels, [0, 0, 255, 255]); |
| 50 t.done(); | 52 }); |
| 53 t.done(); |
| 54 }, 0); |
| 51 }, 0); | 55 }, 0); |
| 52 }, "Verify that the placeholder canvas can be used as an image source"); | 56 }, "Verify that the placeholder canvas can be used as an image source"); |
| 53 </script> | 57 </script> |
| OLD | NEW |