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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/files/blob-constructor.html

Issue 2147633002: Remove nonstandard 'endings' option for Blob/File constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/files/blob-constructor-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 2
3 <script src="../../resources/js-test.js"></script> 3 <script src="../../resources/js-test.js"></script>
4 <script> 4 <script>
5 description("Test the Blob constructor."); 5 description("Test the Blob constructor.");
6 var jsTestIsAsync = true; 6 var jsTestIsAsync = true;
7 7
8 // Test the different ways you can construct a Blob. 8 // Test the different ways you can construct a Blob.
9 shouldBeTrue("(new Blob()) instanceof window.Blob"); 9 shouldBeTrue("(new Blob()) instanceof window.Blob");
10 shouldBeTrue("(new Blob(undefined)) instanceof window.Blob"); 10 shouldBeTrue("(new Blob(undefined)) instanceof window.Blob");
11 shouldBeTrue("(new Blob([])) instanceof window.Blob"); 11 shouldBeTrue("(new Blob([])) instanceof window.Blob");
12 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob"); 12 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob");
13 shouldBeTrue("(new Blob(['hello'], {})) instanceof window.Blob"); 13 shouldBeTrue("(new Blob(['hello'], {})) instanceof window.Blob");
14 shouldBeTrue("(new Blob(['hello'], {type:'text/html'})) instanceof window.Blob") ; 14 shouldBeTrue("(new Blob(['hello'], {type:'text/html'})) instanceof window.Blob") ;
15 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'native'})) instan ceof window.Blob");
16 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'transparent'})) i nstanceof window.Blob");
17 15
18 // Test default sizes/types. 16 // Test default sizes/types.
19 shouldBe("(new Blob()).size", "0"); 17 shouldBe("(new Blob()).size", "0");
20 shouldBe("(new Blob(undefined)).size", "0"); 18 shouldBe("(new Blob(undefined)).size", "0");
21 shouldBeEqualToString("(new Blob()).type", ""); 19 shouldBeEqualToString("(new Blob()).type", "");
22 shouldBeEqualToString("(new Blob(undefined)).type", ""); 20 shouldBeEqualToString("(new Blob(undefined)).type", "");
23 21
24 // Test invalid blob parts. 22 // Test invalid blob parts.
25 shouldThrow("new Blob('hello')", '"TypeError: Failed to construct \'Blob\': The 1st argument is neither an array, nor does it have indexed properties."'); 23 shouldThrow("new Blob('hello')", '"TypeError: Failed to construct \'Blob\': The 1st argument is neither an array, nor does it have indexed properties."');
26 shouldThrow("new Blob(0)", '"TypeError: Failed to construct \'Blob\': The 1st ar gument is neither an array, nor does it have indexed properties."'); 24 shouldThrow("new Blob(0)", '"TypeError: Failed to construct \'Blob\': The 1st ar gument is neither an array, nor does it have indexed properties."');
(...skipping 13 matching lines...) Expand all
40 shouldBe("(new Blob([document])).size", "21"); // document.toString() is the st ring "[object HTMLDocument]" 38 shouldBe("(new Blob([document])).size", "21"); // document.toString() is the st ring "[object HTMLDocument]"
41 39
42 var toStringingObj = { toString: function() { return "A string"; } }; 40 var toStringingObj = { toString: function() { return "A string"; } };
43 shouldBe("(new Blob([toStringingObj])).size", "8"); 41 shouldBe("(new Blob([toStringingObj])).size", "8");
44 42
45 var throwingObj = { toString: function() { throw "Error"; } }; 43 var throwingObj = { toString: function() { throw "Error"; } };
46 shouldThrow("new Blob([throwingObj])", "'Error'"); 44 shouldThrow("new Blob([throwingObj])", "'Error'");
47 45
48 // Test some invalid property bags. 46 // Test some invalid property bags.
49 shouldBeTrue("(new Blob([], {unknownKey:'value'})) instanceof window.Blob"); // Ignore invalid keys 47 shouldBeTrue("(new Blob([], {unknownKey:'value'})) instanceof window.Blob"); // Ignore invalid keys
50 shouldThrow("new Blob([], {endings:'illegalValue'})", "'TypeError: Failed to con struct \\'Blob\\': The provided value \\'illegalValue\\' is not a valid enum val ue of type NormalizeLineEndings.'");
51 shouldThrow("new Blob([], {endings:throwingObj})", "'Error'");
52 shouldThrow("new Blob([], {type:throwingObj})", "'Error'"); 48 shouldThrow("new Blob([], {type:throwingObj})", "'Error'");
53 shouldThrow("new Blob([], {type:'hello\u00EE'})", "'SyntaxError: Failed to const ruct \\'Blob\\': The \\'type\\' property must consist of ASCII characters.'"); 49 shouldThrow("new Blob([], {type:'hello\u00EE'})", "'SyntaxError: Failed to const ruct \\'Blob\\': The \\'type\\' property must consist of ASCII characters.'");
54 50
55 // Test that order of property bag evaluation is lexigraphical
56 var throwingObj1 = { toString: function() { throw "Error 1"; } };
57 var throwingObj2 = { toString: function() { throw "Error 2"; } };
58 shouldThrow("new Blob([], {endings:throwingObj1, type:throwingObj2})", "'Error 1 '");
59 shouldThrow("new Blob([], {type:throwingObj2, endings:throwingObj1})", "'Error 1 '");
60 shouldThrow("new Blob([], {type:throwingObj2, endings:'illegal'})", "'TypeError: Failed to construct \\'Blob\\': The provided value \\'illegal\\' is not a valid enum value of type NormalizeLineEndings.'");
61
62 // Test various non-object literals being used as property bags. 51 // Test various non-object literals being used as property bags.
63 shouldBeTrue("(new Blob([], null)) instanceof window.Blob"); 52 shouldBeTrue("(new Blob([], null)) instanceof window.Blob");
64 shouldBeTrue("(new Blob([], undefined)) instanceof window.Blob"); 53 shouldBeTrue("(new Blob([], undefined)) instanceof window.Blob");
65 shouldThrow("(new Blob([], 123)) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); 54 shouldThrow("(new Blob([], 123)) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'");
66 shouldThrow("(new Blob([], 123.4)) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); 55 shouldThrow("(new Blob([], 123.4)) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'");
67 shouldThrow("(new Blob([], true)) instanceof window.Blob", "'TypeError: Failed t o construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); 56 shouldThrow("(new Blob([], true)) instanceof window.Blob", "'TypeError: Failed t o construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'");
68 shouldThrow("(new Blob([], 'abc')) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'"); 57 shouldThrow("(new Blob([], 'abc')) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': parameter 2 (\\'options\\') is not an object.'");
69 shouldBeTrue("(new Blob([], [])) instanceof window.Blob"); 58 shouldBeTrue("(new Blob([], [])) instanceof window.Blob");
70 shouldBeTrue("(new Blob([], /abc/)) instanceof window.Blob"); 59 shouldBeTrue("(new Blob([], /abc/)) instanceof window.Blob");
71 shouldBeTrue("(new Blob([], function () {})) instanceof window.Blob"); 60 shouldBeTrue("(new Blob([], function () {})) instanceof window.Blob");
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 reader = new FileReader(); 127 reader = new FileReader();
139 reader.readAsText(new Blob([CONTAINS_UNPAIRED_SURROGATES])); 128 reader.readAsText(new Blob([CONTAINS_UNPAIRED_SURROGATES]));
140 reader.onload = function() { 129 reader.onload = function() {
141 shouldBe("reader.result.charCodeAt(3)", "0xFFFD"); 130 shouldBe("reader.result.charCodeAt(3)", "0xFFFD");
142 shouldBe("reader.result.charCodeAt(7)", "0xFFFD"); 131 shouldBe("reader.result.charCodeAt(7)", "0xFFFD");
143 finishJSTest(); 132 finishJSTest();
144 }; 133 };
145 } 134 }
146 135
147 </script> 136 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/files/blob-constructor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698