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

Side by Side Diff: LayoutTests/fast/canvas/canvas-lineDash-input-sequence.html

Issue 38063003: Improve TypeError messages from failed array conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve TypeError messages from failed array conversions. Created 7 years, 1 month 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
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <link rel="help" href="http://www.w3.org/TR/2013/WD-2dcontext2-20130528/#dom-con text-2d-setlinedash"> 4 <link rel="help" href="http://www.w3.org/TR/2013/WD-2dcontext2-20130528/#dom-con text-2d-setlinedash">
5 <script src="../js/resources/js-test-pre.js"></script> 5 <script src="../js/resources/js-test-pre.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <script> 8 <script>
9 description("Test that setLineDash converts input argument into a Web IDL sequen ce"); 9 description("Test that setLineDash converts input argument into a Web IDL sequen ce");
10 10
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 var lineDash; 33 var lineDash;
34 var inputArray; 34 var inputArray;
35 function checkLineDash(testArray, shouldFail) { 35 function checkLineDash(testArray, shouldFail) {
36 inputArray = testArray; 36 inputArray = testArray;
37 // Reset line dash. 37 // Reset line dash.
38 ctx.setLineDash([]); 38 ctx.setLineDash([]);
39 // Set line dash. 39 // Set line dash.
40 if (shouldFail) { 40 if (shouldFail) {
41 shouldThrow("ctx.setLineDash(inputArray)", "'TypeError: Type error'"); 41 shouldThrow("ctx.setLineDash(inputArray)", "'TypeError: First argument i s neither an array, nor does it have indexed properties.'");
42 } else { 42 } else {
43 ctx.setLineDash(inputArray); 43 ctx.setLineDash(inputArray);
44 lineDash = ctx.getLineDash(); 44 lineDash = ctx.getLineDash();
45 for (var i = 0; i < arrayValues.length; ++i) 45 for (var i = 0; i < arrayValues.length; ++i)
46 shouldBe("lineDash[" + i + "]", "" + arrayValues[i]); 46 shouldBe("lineDash[" + i + "]", "" + arrayValues[i]);
47 } 47 }
48 } 48 }
49 49
50 var arrayTypes = [Array, Int8Array, Int16Array, Int32Array, Uint8Array, Uint16Ar ray, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray, Object]; 50 var arrayTypes = [Array, Int8Array, Int16Array, Int32Array, Uint8Array, Uint16Ar ray, Uint32Array, Float32Array, Float64Array, Uint8ClampedArray, Object];
51 51
(...skipping 17 matching lines...) Expand all
69 debug("* Test passing a Boolean as input."); 69 debug("* Test passing a Boolean as input.");
70 checkLineDash(true, true); 70 checkLineDash(true, true);
71 debug("* Test passing null as input."); 71 debug("* Test passing null as input.");
72 checkLineDash(null, true); 72 checkLineDash(null, true);
73 debug("* Test passing undefined as input."); 73 debug("* Test passing undefined as input.");
74 checkLineDash(undefined, true); 74 checkLineDash(undefined, true);
75 </script> 75 </script>
76 <script src="../js/resources/js-test-post.js"></script> 76 <script src="../js/resources/js-test-post.js"></script>
77 </body> 77 </body>
78 </html> 78 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/generateKey-expected.txt ('k') | LayoutTests/fast/canvas/canvas-lineDash-input-sequence-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698