OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Blob slice</title> | 3 <title>Blob slice</title> |
4 <link rel=help href="http://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo"> | 4 <link rel=help href="https://w3c.github.io/FileAPI/#slice-method-algo"> |
5 <link rel=author title="Saurabh Anand" href="mailto:saurabhanandiit@gmail.com"> | 5 <link rel=author title="Saurabh Anand" href="mailto:saurabhanandiit@gmail.com"> |
6 <script src="../../../../resources/testharness.js"></script> | 6 <script src="../../../../resources/testharness.js"></script> |
7 <script src="../../../../resources/testharnessreport.js"></script> | 7 <script src="../../../../resources/testharnessreport.js"></script> |
8 <script src="../support/Blob.js"></script> | 8 <script src="../support/Blob.js"></script> |
9 <div id="log"></div> | 9 <div id="log"></div> |
10 <script> | 10 <script> |
11 test_blob(function() { | 11 test_blob(function() { |
12 var blobTemp = new Blob(["PASS"]); | 12 var blobTemp = new Blob(["PASS"]); |
13 return blobTemp.slice(); | 13 return blobTemp.slice(); |
14 }, { | 14 }, { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 type: "", | 155 type: "", |
156 desc: "Slicing test: slice (" + i + "," + j + ")." | 156 desc: "Slicing test: slice (" + i + "," + j + ")." |
157 }); | 157 }); |
158 }, "Slicing test (" + i + "," + j + ")."); | 158 }, "Slicing test (" + i + "," + j + ")."); |
159 }); | 159 }); |
160 }); | 160 }); |
161 }, "Slices"); | 161 }, "Slices"); |
162 | 162 |
163 var invalidTypes = [ | 163 var invalidTypes = [ |
164 "\xFF", | 164 "\xFF", |
| 165 "te\x09xt/plain", |
| 166 "te\x00xt/plain", |
| 167 "te\x1Fxt/plain", |
| 168 "te\x7Fxt/plain" |
| 169 ]; |
| 170 invalidTypes.forEach(function(type) { |
| 171 test_blob(function() { |
| 172 var blob = new Blob(["PASS"]); |
| 173 return blob.slice(0, 4, type); |
| 174 }, { |
| 175 expected: "PASS", |
| 176 type: "", |
| 177 desc: "Invalid contentType (" + format_value(type) + ")" |
| 178 }); |
| 179 }); |
| 180 |
| 181 var validTypes = [ |
165 "te(xt/plain", | 182 "te(xt/plain", |
166 "te)xt/plain", | 183 "te)xt/plain", |
167 "te<xt/plain", | 184 "te<xt/plain", |
168 "te>xt/plain", | 185 "te>xt/plain", |
169 "te@xt/plain", | 186 "te@xt/plain", |
170 "te,xt/plain", | 187 "te,xt/plain", |
171 "te;xt/plain", | 188 "te;xt/plain", |
172 "te:xt/plain", | 189 "te:xt/plain", |
173 "te\\xt/plain", | 190 "te\\xt/plain", |
174 "te\"xt/plain", | 191 "te\"xt/plain", |
175 "te/xt/plain", | 192 "te/xt/plain", |
176 "te[xt/plain", | 193 "te[xt/plain", |
177 "te]xt/plain", | 194 "te]xt/plain", |
178 "te?xt/plain", | 195 "te?xt/plain", |
179 "te=xt/plain", | 196 "te=xt/plain", |
180 "te{xt/plain", | 197 "te{xt/plain", |
181 "te}xt/plain", | 198 "te}xt/plain", |
182 "te\x20xt/plain", | 199 "te\x20xt/plain", |
183 "te\x09xt/plain", | |
184 "te\x00xt/plain", | |
185 "te\x1Fxt/plain", | |
186 "te\x7Fxt/plain" | |
187 ]; | |
188 invalidTypes.forEach(function(type) { | |
189 test_blob(function() { | |
190 var blob = new Blob(["PASS"]); | |
191 return blob.slice(0, 4, type); | |
192 }, { | |
193 expected: "PASS", | |
194 type: "", | |
195 desc: "Invalid contentType (" + format_value(type) + ")" | |
196 }); | |
197 }); | |
198 | |
199 var validTypes = [ | |
200 "TEXT/PLAIN", | 200 "TEXT/PLAIN", |
201 "text/plain;charset = UTF-8", | 201 "text/plain;charset = UTF-8", |
202 "text/plain;charset=UTF-8" | 202 "text/plain;charset=UTF-8" |
203 ]; | 203 ]; |
204 validTypes.forEach(function(type) { | 204 validTypes.forEach(function(type) { |
205 test_blob(function() { | 205 test_blob(function() { |
206 var blob = new Blob(["PASS"]); | 206 var blob = new Blob(["PASS"]); |
207 return blob.slice(0, 4, type); | 207 return blob.slice(0, 4, type); |
208 }, { | 208 }, { |
209 expected: "PASS", | 209 expected: "PASS", |
210 type: type.toLowerCase(), | 210 type: type.toLowerCase(), |
211 desc: "Valid contentType (" + format_value(type) + ")" | 211 desc: "Valid contentType (" + format_value(type) + ")" |
212 }); | 212 }); |
213 }); | 213 }); |
214 </script> | 214 </script> |
OLD | NEW |