| 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 id="myWorker" type="text/worker"> | 4 <script id="myWorker" type="text/worker"> |
| 5 self.onmessage = function(e) { | 5 self.onmessage = function(e) { |
| 6 }; | 6 }; |
| 7 </script> | 7 </script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 function makeWorker(script) | 10 function makeWorker(script) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 }, "Test that call convertToBlob on a detached OffscreenCanvas throws exception"
); | 26 }, "Test that call convertToBlob on a detached OffscreenCanvas throws exception"
); |
| 27 | 27 |
| 28 async_test(function(t) { | 28 async_test(function(t) { |
| 29 var offscreenCanvas = new OffscreenCanvas(0, 0); | 29 var offscreenCanvas = new OffscreenCanvas(0, 0); |
| 30 offscreenCanvas.convertToBlob().then(t.step_func_done(function() { | 30 offscreenCanvas.convertToBlob().then(t.step_func_done(function() { |
| 31 assert_false("convertToBlob didn't throw, but should be"); | 31 assert_false("convertToBlob didn't throw, but should be"); |
| 32 }), t.step_func_done(function(e) { | 32 }), t.step_func_done(function(e) { |
| 33 assert_true(e instanceof DOMException); | 33 assert_true(e instanceof DOMException); |
| 34 assert_equals(e.name, "IndexSizeError"); | 34 assert_equals(e.name, "IndexSizeError"); |
| 35 })); | 35 })); |
| 36 }, "Test that call convertToBlob on a OffscreenCanvas with size 0 throws excepti
on"); | 36 }, "Test that call convertToBlob on an OffscreenCanvas with size 0 throws except
ion"); |
| 37 |
| 38 async_test(function(t) { |
| 39 var webp_max_dimension = 16383; // Based on WEBPImageEncoder.cpp?l=52 |
| 40 var offscreenCanvas = new OffscreenCanvas(10, webp_max_dimension + 1); |
| 41 var ctx = offscreenCanvas.getContext("2d"); |
| 42 offscreenCanvas.convertToBlob({type: "image/webp"}).then(t.step_func_done(fu
nction() { |
| 43 assert_false("convertToBlob didn't throw, but should be"); |
| 44 }), t.step_func_done(function(e) { |
| 45 assert_true(e instanceof DOMException); |
| 46 assert_equals(e.name, "EncodingError"); |
| 47 })); |
| 48 }, "Test that call convertToBlob throws EncodingError exception when encoding fa
ils"); |
| 49 |
| 50 async_test(function(t) { |
| 51 var offscreenCanvas = new OffscreenCanvas(10, 10); |
| 52 offscreenCanvas.convertToBlob().then(t.step_func_done(function() { |
| 53 assert_false("convertToBlob didn't throw, but should be"); |
| 54 }), t.step_func_done(function(e) { |
| 55 assert_true(e instanceof DOMException); |
| 56 assert_equals(e.name, "InvalidStateError"); |
| 57 })); |
| 58 }, "Test that call convertToBlob on an OffscreenCanvas without contexts throws e
xception"); |
| 37 | 59 |
| 38 </script> | 60 </script> |
| 39 | 61 |
| OLD | NEW |