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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 description("Test the behavior of CanvasRenderingContext2D.setShadow() when call ed with different numbers of arguments."); 1 description("Test the behavior of CanvasRenderingContext2D.setShadow() when call ed with different numbers of arguments.");
2 2
3 var ctx = document.createElement('canvas').getContext('2d'); 3 var ctx = document.createElement('canvas').getContext('2d');
4 4
5 function ExpectedNotEnoughArgumentsMessage(num) {
6 return "\"TypeError: Failed to execute 'setShadow' on 'CanvasRenderingContex t2D': 3 arguments required, but only " + num + " present.\"";
7 }
8
5 var TypeError = "TypeError: Type error"; 9 var TypeError = "TypeError: Type error";
6 var TypeErrorNotEnoughArguments = "TypeError: Not enough arguments";
7 10
8 shouldThrow("ctx.setShadow()", "TypeErrorNotEnoughArguments"); 11 shouldThrow("ctx.setShadow()", ExpectedNotEnoughArgumentsMessage(0));
9 shouldThrow("ctx.setShadow(0)", "TypeErrorNotEnoughArguments"); 12 shouldThrow("ctx.setShadow(0)", ExpectedNotEnoughArgumentsMessage(1));
10 shouldThrow("ctx.setShadow(0, 0)", "TypeErrorNotEnoughArguments"); 13 shouldThrow("ctx.setShadow(0, 0)", ExpectedNotEnoughArgumentsMessage(2));
11 shouldBe("ctx.setShadow(0, 0, 0)", "undefined"); 14 shouldBe("ctx.setShadow(0, 0, 0)", "undefined");
12 shouldBe("ctx.setShadow(0, 0, 0, 0)", "undefined"); 15 shouldBe("ctx.setShadow(0, 0, 0, 0)", "undefined");
13 shouldBe("ctx.setShadow(0, 0, 0, 0, 0)", "undefined"); 16 shouldBe("ctx.setShadow(0, 0, 0, 0, 0)", "undefined");
14 shouldThrow("ctx.setShadow(0, 0, 0, 0, 0, 0)", "TypeError"); 17 shouldThrow("ctx.setShadow(0, 0, 0, 0, 0, 0)", "TypeError");
15 shouldBe("ctx.setShadow(0, 0, 0, 0, 'red')", "undefined"); 18 shouldBe("ctx.setShadow(0, 0, 0, 0, 'red')", "undefined");
16 shouldThrow("ctx.setShadow(0, 0, 0, 0, 'red', 0)", "TypeError"); 19 shouldThrow("ctx.setShadow(0, 0, 0, 0, 'red', 0)", "TypeError");
17 shouldBe("ctx.setShadow(0, 0, 0, 0, 'red', 0, 0)", "undefined"); 20 shouldBe("ctx.setShadow(0, 0, 0, 0, 'red', 0, 0)", "undefined");
18 shouldThrow("ctx.setShadow(0, 0, 0, 0, 0, 0)", "TypeError"); 21 shouldThrow("ctx.setShadow(0, 0, 0, 0, 0, 0)", "TypeError");
19 shouldBe("ctx.setShadow(0, 0, 0, 0, 0, 0, 0)", "undefined"); 22 shouldBe("ctx.setShadow(0, 0, 0, 0, 0, 0, 0)", "undefined");
20 shouldBe("ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 23 shouldBe("ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0)", "undefined");
21 shouldThrow("ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeError"); 24 shouldThrow("ctx.setShadow(0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeError");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698