Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-invalid.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-invalid.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-invalid.html |
| index 913654022c36e2675defd24737f97027a9141e5e..d8cb67235f94598de557567fe3b7c7836dfc752a 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-invalid.html |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-invalid.html |
| @@ -1,32 +1,29 @@ |
| -<script src="../../resources/js-test.js"></script> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| <script type='text/javascript'> |
| -description("Test the handling of invalid arguments in canvas toBlob()."); |
| +async_test(t => { |
| -if (window.testRunner) { |
| - testRunner.dumpAsText(); |
| - testRunner.waitUntilDone(); |
| -} |
| - |
| -var numAsyncCalls = 2; |
| -function finishOneAsyncCall() |
| -{ |
| - numAsyncCalls--; |
| - if (numAsyncCalls == 0 && window.testRunner) { |
| - testRunner.notifyDone(); |
| + var numAsyncCalls = 2; |
| + function finishOneAsyncCall() |
| + { |
| + if (--numAsyncCalls == 0) |
| + t.done(); |
| } |
| -} |
| - |
| -var canvas = document.createElement('canvas'); |
| -var ctx = canvas.getContext("2d"); |
| -ctx.strokeStyle = "red"; |
| -ctx.strokeRect(0, 0, 50, 50); |
| - |
| -shouldThrow("canvas.toBlob();"); |
| -shouldThrow("canvas.toBlob(null);"); |
| -shouldThrow("canvas.toBlob(undefined);"); |
| -// Passing the callback argument without blob handle silently fails. |
| -shouldNotThrow("canvas.toBlob(function() { finishOneAsyncCall(); });"); |
| + |
| + var canvas = document.createElement('canvas'); |
| + var ctx = canvas.getContext("2d"); |
| + ctx.strokeStyle = "red"; |
| + ctx.strokeRect(0, 0, 50, 50); |
| + |
| + assert_throws(null, function() {canvas.toBlob();}); |
|
Justin Novosad
2017/02/15 19:55:28
assert_throws allows you to test for specific exce
zakerinasab
2017/02/16 17:16:18
Done.
|
| + assert_throws(null, function() {canvas.toBlob(null);}); |
| + assert_throws(null, function() {canvas.toBlob(undefined);}); |
| -// Invalid quality argument will fall back to default value |
| -shouldNotThrow("canvas.toBlob(function(blob) { finishOneAsyncCall(); }, 'image/jpeg', 500)"); |
| + // Passing the callback argument without blob handle silently fails. |
| + canvas.toBlob(function() { finishOneAsyncCall(); }); |
| + |
| + // Invalid quality argument will fall back to default value |
| + canvas.toBlob(function(blob) { finishOneAsyncCall(); }, 'image/jpeg', 500); |
| + |
| +}, "Test the handling of invalid arguments in canvas toBlob()."); |
| </script> |