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

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

Issue 2812833003: Revert of [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 years, 8 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
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");
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 shouldBe("new Blob([(new Uint16Array(100)).buffer]).size", "200"); 116 shouldBe("new Blob([(new Uint16Array(100)).buffer]).size", "200");
117 shouldBe("new Blob([(new Uint32Array(100)).buffer]).size", "400"); 117 shouldBe("new Blob([(new Uint32Array(100)).buffer]).size", "400");
118 shouldBe("new Blob([(new Int8Array(100)).buffer]).size", "100"); 118 shouldBe("new Blob([(new Int8Array(100)).buffer]).size", "100");
119 shouldBe("new Blob([(new Int16Array(100)).buffer]).size", "200"); 119 shouldBe("new Blob([(new Int16Array(100)).buffer]).size", "200");
120 shouldBe("new Blob([(new Int32Array(100)).buffer]).size", "400"); 120 shouldBe("new Blob([(new Int32Array(100)).buffer]).size", "400");
121 shouldBe("new Blob([(new Float32Array(100)).buffer]).size", "400"); 121 shouldBe("new Blob([(new Float32Array(100)).buffer]).size", "400");
122 shouldBe("new Blob([(new Float64Array(100)).buffer]).size", "800"); 122 shouldBe("new Blob([(new Float64Array(100)).buffer]).size", "800");
123 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer , (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).si ze", "1400"); 123 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer , (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).si ze", "1400");
124 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"); 124 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");
125 125
126 if (window.SharedArrayBuffer) {
127 // Test SharedArrayBuffer parameters.
128 shouldThrow("new Blob([new Uint8Array(new SharedArrayBuffer(4))])", '"TypeErro r: Failed to construct \'Blob\': The provided ArrayBufferView value must not be shared."');
129 }
130
131 // Test passing blob parts in objects with indexed properties. 126 // Test passing blob parts in objects with indexed properties.
132 // (This depends on the bindings code handling of sequence<T>) 127 // (This depends on the bindings code handling of sequence<T>)
133 shouldBe("new Blob({length: 0}).size", "0"); 128 shouldBe("new Blob({length: 0}).size", "0");
134 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6"); 129 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6");
135 130
136 testNormalization(); 131 testNormalization();
137 132
138 function testNormalization() { 133 function testNormalization() {
139 // Test that strings are not NFC normalized 134 // Test that strings are not NFC normalized
140 OMICRON_WITH_OXIA = '\u1F79'; // NFC normalized to U+3CC 135 OMICRON_WITH_OXIA = '\u1F79'; // NFC normalized to U+3CC
(...skipping 14 matching lines...) Expand all
155 reader = new FileReader(); 150 reader = new FileReader();
156 reader.readAsText(new Blob([CONTAINS_UNPAIRED_SURROGATES])); 151 reader.readAsText(new Blob([CONTAINS_UNPAIRED_SURROGATES]));
157 reader.onload = function() { 152 reader.onload = function() {
158 shouldBe("reader.result.charCodeAt(3)", "0xFFFD"); 153 shouldBe("reader.result.charCodeAt(3)", "0xFFFD");
159 shouldBe("reader.result.charCodeAt(7)", "0xFFFD"); 154 shouldBe("reader.result.charCodeAt(7)", "0xFFFD");
160 finishJSTest(); 155 finishJSTest();
161 }; 156 };
162 } 157 }
163 158
164 </script> 159 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698