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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 description("Test the behavior of CanvasRenderingContext2D.strokeText() when cal led with different numbers of arguments."); 1 description("Test the behavior of CanvasRenderingContext2D.strokeText() when cal led 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 var NotEnoughArguments = "TypeError: Not enough arguments"; 5 function ExpectedMessage(num) {
6 return "\"TypeError: Failed to execute 'strokeText' on 'CanvasRenderingConte xt2D': 3 arguments required, but only " + num + " present.\"";
7 }
6 8
7 shouldThrow("ctx.strokeText()", "NotEnoughArguments"); 9 shouldThrow("ctx.strokeText()", ExpectedMessage(0));
8 shouldThrow("ctx.strokeText('moo')", "NotEnoughArguments"); 10 shouldThrow("ctx.strokeText('moo')", ExpectedMessage(1));
9 shouldThrow("ctx.strokeText('moo',0)", "NotEnoughArguments"); 11 shouldThrow("ctx.strokeText('moo',0)", ExpectedMessage(2));
10 shouldBe("ctx.strokeText('moo',0,0)", "undefined"); 12 shouldBe("ctx.strokeText('moo',0,0)", "undefined");
11 shouldBe("ctx.strokeText('moo',0,0,0)", "undefined"); 13 shouldBe("ctx.strokeText('moo',0,0,0)", "undefined");
12 shouldBe("ctx.strokeText('moo',0,0,0,0)", "undefined"); 14 shouldBe("ctx.strokeText('moo',0,0,0,0)", "undefined");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698