Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 if (self.importScripts) { | 1 if (self.importScripts) { |
| 2 importScripts('../resources/fetch-test-helpers.js'); | 2 importScripts('../resources/fetch-test-helpers.js'); |
| 3 } | 3 } |
| 4 | 4 |
| 5 function consume(reader) { | 5 function consume(reader) { |
| 6 var chunks = []; | 6 var chunks = []; |
| 7 function rec(reader) { | 7 function rec(reader) { |
| 8 return reader.read().then(function(r) { | 8 return reader.read().then(function(r) { |
| 9 if (r.done) { | 9 if (r.done) { |
| 10 return chunks; | 10 return chunks; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 promise_test(function(t) { | 301 promise_test(function(t) { |
| 302 var res = new Response(new Blob([''])); | 302 var res = new Response(new Blob([''])); |
| 303 return res.blob() | 303 return res.blob() |
| 304 .then(function(blob) { | 304 .then(function(blob) { |
| 305 assert_equals(blob.type, ''); | 305 assert_equals(blob.type, ''); |
| 306 assert_equals(res.headers.get('Content-Type'), null); | 306 assert_equals(res.headers.get('Content-Type'), null); |
| 307 }); | 307 }); |
| 308 }, 'MIME type for Blob'); | 308 }, 'MIME type for Blob'); |
| 309 | 309 |
| 310 promise_test(function(t) { | 310 promise_test(function(t) { |
| 311 var res = new Response(new Blob([''], {type: 'Text/Plain'})); | 311 var res = new Response(new Blob(['hello'], {type: 'Text/Plain'})); |
| 312 return res.blob() | 312 return res.blob() |
| 313 .then(function(blob) { | 313 .then(function(blob) { |
| 314 assert_equals(blob.type, 'text/plain'); | 314 assert_equals(blob.type, 'text/plain'); |
| 315 assert_equals(blob.size, 5); | |
| 316 assert_equals(res.headers.get('Content-Type'), 'text/plain'); | |
| 317 return res.blob(); | |
| 318 }).then(function(blob) { | |
|
hiroshige
2015/04/21 07:17:13
Please add a comment that states what we are testi
yhirano
2015/04/22 02:35:30
Done.
| |
| 319 assert_equals(blob.type, 'text/plain'); | |
| 320 assert_equals(blob.size, 0); | |
| 315 assert_equals(res.headers.get('Content-Type'), 'text/plain'); | 321 assert_equals(res.headers.get('Content-Type'), 'text/plain'); |
| 316 }); | 322 }); |
| 317 }, 'MIME type for Blob with non-empty type'); | 323 }, 'MIME type for Blob with non-empty type'); |
| 318 | 324 |
| 319 promise_test(function(t) { | 325 promise_test(function(t) { |
| 320 var res = new Response(new FormData()); | 326 var res = new Response(new FormData()); |
| 321 return res.blob() | 327 return res.blob() |
| 322 .then(function(blob) { | 328 .then(function(blob) { |
| 323 assert_equals(blob.type.indexOf('multipart/form-data; boundary='), | 329 assert_equals(blob.type.indexOf('multipart/form-data; boundary='), |
| 324 0); | 330 0); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 assert_equals(texts[0], ''); | 425 assert_equals(texts[0], ''); |
| 420 assert_equals(texts[1], ''); | 426 assert_equals(texts[1], ''); |
| 421 return res.body.getReader().read(); | 427 return res.body.getReader().read(); |
| 422 }).then(function(r) { | 428 }).then(function(r) { |
| 423 assert_true(r.done); | 429 assert_true(r.done); |
| 424 assert_equals(r.value, undefined); | 430 assert_equals(r.value, undefined); |
| 425 }); | 431 }); |
| 426 }, 'Read after text()'); | 432 }, 'Read after text()'); |
| 427 | 433 |
| 428 done(); | 434 done(); |
| OLD | NEW |