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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-invalid.html

Issue 2695963004: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698