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

Unified Diff: LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js

Issue 24203002: Improve generated "Not enough arguments." TypeError exceptions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: NeedsRebaseline Created 7 years, 3 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: LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js b/LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js
index 211bfe0e96098766dcb53cac73e381e74ac11b6e..be94257d139b9bc5d4a618b3d443ec8d7bf5bf52 100644
--- a/LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js
+++ b/LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js
@@ -2,12 +2,15 @@ description("Test the behavior of CanvasRenderingContext2D.setShadow() when call
var ctx = document.createElement('canvas').getContext('2d');
+function ExpectedNotEnoughArgumentsMessage(num) {
+ return "\"TypeError: Failed to execute 'setShadow' on 'CanvasRenderingContext2D': 3 arguments required, but only " + num + " present.\"";
+}
+
var TypeError = "TypeError: Type error";
-var TypeErrorNotEnoughArguments = "TypeError: Not enough arguments";
-shouldThrow("ctx.setShadow()", "TypeErrorNotEnoughArguments");
-shouldThrow("ctx.setShadow(0)", "TypeErrorNotEnoughArguments");
-shouldThrow("ctx.setShadow(0, 0)", "TypeErrorNotEnoughArguments");
+shouldThrow("ctx.setShadow()", ExpectedNotEnoughArgumentsMessage(0));
+shouldThrow("ctx.setShadow(0)", ExpectedNotEnoughArgumentsMessage(1));
+shouldThrow("ctx.setShadow(0, 0)", ExpectedNotEnoughArgumentsMessage(2));
shouldBe("ctx.setShadow(0, 0, 0)", "undefined");
shouldBe("ctx.setShadow(0, 0, 0, 0)", "undefined");
shouldBe("ctx.setShadow(0, 0, 0, 0, 0)", "undefined");

Powered by Google App Engine
This is Rietveld 408576698