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

Unified Diff: LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeText.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-strokeText.js
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeText.js b/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeText.js
index 037bb0be71c2c3e468be46420bc1c0071db30a12..f794ed15a2347d3188d991c54267c482a7b13c33 100644
--- a/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeText.js
+++ b/LayoutTests/fast/canvas/script-tests/canvas-overloads-strokeText.js
@@ -2,11 +2,13 @@ description("Test the behavior of CanvasRenderingContext2D.strokeText() when cal
var ctx = document.createElement('canvas').getContext('2d');
-var NotEnoughArguments = "TypeError: Not enough arguments";
+function ExpectedMessage(num) {
+ return "\"TypeError: Failed to execute 'strokeText' on 'CanvasRenderingContext2D': 3 arguments required, but only " + num + " present.\"";
+}
-shouldThrow("ctx.strokeText()", "NotEnoughArguments");
-shouldThrow("ctx.strokeText('moo')", "NotEnoughArguments");
-shouldThrow("ctx.strokeText('moo',0)", "NotEnoughArguments");
+shouldThrow("ctx.strokeText()", ExpectedMessage(0));
+shouldThrow("ctx.strokeText('moo')", ExpectedMessage(1));
+shouldThrow("ctx.strokeText('moo',0)", ExpectedMessage(2));
shouldBe("ctx.strokeText('moo',0,0)", "undefined");
shouldBe("ctx.strokeText('moo',0,0,0)", "undefined");
shouldBe("ctx.strokeText('moo',0,0,0,0)", "undefined");

Powered by Google App Engine
This is Rietveld 408576698