OLD | NEW |
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 | 7 |
7 // Test the different ways you can construct a Blob. | 8 // Test the different ways you can construct a 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([])) instanceof window.Blob"); |
10 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob"); | 11 shouldBeTrue("(new Blob(['hello'])) instanceof window.Blob"); |
11 shouldBeTrue("(new Blob(['hello'], {})) instanceof window.Blob"); | 12 shouldBeTrue("(new Blob(['hello'], {})) instanceof window.Blob"); |
12 shouldBeTrue("(new Blob(['hello'], {type:'text/html'})) instanceof window.Blob")
; | 13 shouldBeTrue("(new Blob(['hello'], {type:'text/html'})) instanceof window.Blob")
; |
13 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'native'})) instan
ceof window.Blob"); | 14 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'native'})) instan
ceof window.Blob"); |
14 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'transparent'})) i
nstanceof window.Blob"); | 15 shouldBeTrue("(new Blob(['hello'], {type:'text/html', endings:'transparent'})) i
nstanceof window.Blob"); |
15 | 16 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 shouldBe("new Blob([(new Int32Array(100)).buffer]).size", "400"); | 101 shouldBe("new Blob([(new Int32Array(100)).buffer]).size", "400"); |
101 shouldBe("new Blob([(new Float32Array(100)).buffer]).size", "400"); | 102 shouldBe("new Blob([(new Float32Array(100)).buffer]).size", "400"); |
102 shouldBe("new Blob([(new Float64Array(100)).buffer]).size", "800"); | 103 shouldBe("new Blob([(new Float64Array(100)).buffer]).size", "800"); |
103 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer
, (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).si
ze", "1400"); | 104 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer
, (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).si
ze", "1400"); |
104 shouldBe("new Blob([new Blob([(new Int32Array(100)).buffer]), (new Uint8Array(10
0)).buffer, (new Float32Array(100)).buffer, (new DataView(new ArrayBuffer(100)))
.buffer]).size", "1000"); | 105 shouldBe("new Blob([new Blob([(new Int32Array(100)).buffer]), (new Uint8Array(10
0)).buffer, (new Float32Array(100)).buffer, (new DataView(new ArrayBuffer(100)))
.buffer]).size", "1000"); |
105 | 106 |
106 // Test passing blob parts in objects with indexed properties. | 107 // Test passing blob parts in objects with indexed properties. |
107 // (This depends on the bindings code handling of sequence<T>) | 108 // (This depends on the bindings code handling of sequence<T>) |
108 shouldBe("new Blob({length: 0}).size", "0"); | 109 shouldBe("new Blob({length: 0}).size", "0"); |
109 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6"); | 110 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6"); |
| 111 |
| 112 // Test that strings are not NFC normalized |
| 113 var OMICRON_WITH_OXIA = '\u1F79'; // NFC normalized to U+3CC |
| 114 shouldBe("OMICRON_WITH_OXIA.charCodeAt(0)", "0x1F79"); |
| 115 var reader = new FileReader(); |
| 116 reader.readAsText(new Blob([OMICRON_WITH_OXIA])); |
| 117 reader.onload = function() { |
| 118 shouldBe("reader.result.charCodeAt(0)", "0x1F79"); |
| 119 finishJSTest(); |
| 120 }; |
110 </script> | 121 </script> |
OLD | NEW |