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

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

Issue 74213009: File constructor understands lastModified. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed feedback. 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
« no previous file with comments | « no previous file | 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 6
7 // Test the different ways you can construct a Blob. 7 // Test the different ways you can construct a Blob.
8 shouldBeTrue("(new Blob()) instanceof window.Blob"); 8 shouldBeTrue("(new Blob()) instanceof window.Blob");
9 shouldBeTrue("(new Blob([])) instanceof window.Blob"); 9 shouldBeTrue("(new Blob([])) instanceof window.Blob");
10 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob"); 10 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob");
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 shouldThrow("(new Blob([], null)) instanceof window.Blob", "'TypeError: Failed t o construct \\'Blob\\': The 2nd argument is not of type Object.'"); 54 shouldThrow("(new Blob([], null)) instanceof window.Blob", "'TypeError: Failed t o construct \\'Blob\\': The 2nd argument is not of type Object.'");
55 shouldThrow("(new Blob([], undefined)) instanceof window.Blob", "'TypeError: Fai led to construct \\'Blob\\': The 2nd argument is not of type Object.'"); 55 shouldThrow("(new Blob([], undefined)) instanceof window.Blob", "'TypeError: Fai led to construct \\'Blob\\': The 2nd argument is not of type Object.'");
56 shouldThrow("(new Blob([], 123)) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': The 2nd argument is not of type Object.'"); 56 shouldThrow("(new Blob([], 123)) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': The 2nd argument is not of type Object.'");
57 shouldThrow("(new Blob([], 123.4)) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': The 2nd argument is not of type Object.'"); 57 shouldThrow("(new Blob([], 123.4)) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': The 2nd argument is not of type Object.'");
58 shouldThrow("(new Blob([], true)) instanceof window.Blob", "'TypeError: Failed t o construct \\'Blob\\': The 2nd argument is not of type Object.'"); 58 shouldThrow("(new Blob([], true)) instanceof window.Blob", "'TypeError: Failed t o construct \\'Blob\\': The 2nd argument is not of type Object.'");
59 shouldThrow("(new Blob([], 'abc')) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': The 2nd argument is not of type Object.'"); 59 shouldThrow("(new Blob([], 'abc')) instanceof window.Blob", "'TypeError: Failed to construct \\'Blob\\': The 2nd argument is not of type Object.'");
60 shouldBeTrue("(new Blob([], [])) instanceof window.Blob"); 60 shouldBeTrue("(new Blob([], [])) instanceof window.Blob");
61 shouldBeTrue("(new Blob([], /abc/)) instanceof window.Blob"); 61 shouldBeTrue("(new Blob([], /abc/)) instanceof window.Blob");
62 shouldBeTrue("(new Blob([], function () {})) instanceof window.Blob"); 62 shouldBeTrue("(new Blob([], function () {})) instanceof window.Blob");
63 63
64 // Test that the type/size is correctly added to the Blob 64 // Test that the type/size is correctly added to the Blob.
65 shouldBe("(new Blob([], {type:'text/html'})).type", "'text/html'"); 65 shouldBe("(new Blob([], {type:'text/html'})).type", "'text/html'");
66 shouldBe("(new Blob([], {type:'text/html'})).size", "0"); 66 shouldBe("(new Blob([], {type:'text/html'})).size", "0");
67 shouldBe("(new Blob([], {type:'text/plain;charset=UTF-8'})).type", "'text/plain; charset=utf-8'"); 67 shouldBe("(new Blob([], {type:'text/plain;charset=UTF-8'})).type", "'text/plain; charset=utf-8'");
68 68
69 // Test that the File-specific lastModified is not set by the Blob constructor.
70 shouldBe("(new Blob([])).lastModified", "undefined");
71 shouldBe("(new Blob([], {})).lastModified", "undefined");
72 shouldBe("(new Blob([], {lastModified: new Date()})).lastModified", "undefined") ;
73
69 // Test the number of expected arguments in the Blob constructor. 74 // Test the number of expected arguments in the Blob constructor.
70 shouldBe("window.Blob.length", "0"); 75 shouldBe("window.Blob.length", "0");
71 76
72 // Test ArrayBufferView parameters. 77 // Test ArrayBufferView parameters.
73 shouldBe("new Blob([new DataView(new ArrayBuffer(100))]).size", "100"); 78 shouldBe("new Blob([new DataView(new ArrayBuffer(100))]).size", "100");
74 shouldBe("new Blob([new Uint8Array(100)]).size", "100"); 79 shouldBe("new Blob([new Uint8Array(100)]).size", "100");
75 shouldBe("new Blob([new Uint8ClampedArray(100)]).size", "100"); 80 shouldBe("new Blob([new Uint8ClampedArray(100)]).size", "100");
76 shouldBe("new Blob([new Uint16Array(100)]).size", "200"); 81 shouldBe("new Blob([new Uint16Array(100)]).size", "200");
77 shouldBe("new Blob([new Uint32Array(100)]).size", "400"); 82 shouldBe("new Blob([new Uint32Array(100)]).size", "400");
78 shouldBe("new Blob([new Int8Array(100)]).size", "100"); 83 shouldBe("new Blob([new Int8Array(100)]).size", "100");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 Object.defineProperty(throwingSequence, "1", { 115 Object.defineProperty(throwingSequence, "1", {
111 get: function() { throw new Error("Misbehaving property"); }, 116 get: function() { throw new Error("Misbehaving property"); },
112 enumerable: true, configurable: true 117 enumerable: true, configurable: true
113 }); 118 });
114 Object.defineProperty(throwingSequence, "2", { 119 Object.defineProperty(throwingSequence, "2", {
115 get: function() { throw new Error("This should not be thrown"); }, 120 get: function() { throw new Error("This should not be thrown"); },
116 enumerable: true, configurable: true 121 enumerable: true, configurable: true
117 }); 122 });
118 shouldThrow("new Blob(throwingSequence)", "'Error: Misbehaving property'"); 123 shouldThrow("new Blob(throwingSequence)", "'Error: Misbehaving property'");
119 </script> 124 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/files/blob-constructor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698