Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 if (self.importScripts) { | 1 if (self.importScripts) { |
| 2 importScripts('/fetch/resources/fetch-test-helpers.js'); | 2 importScripts('/fetch/resources/fetch-test-helpers.js'); |
| 3 } | 3 } |
| 4 | 4 |
| 5 function read_until_end(reader) { | 5 function read_until_end(reader) { |
| 6 var chunks = []; | 6 var chunks = []; |
| 7 function consume() { | 7 function consume() { |
| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 return read_until_end(original.clone().body.getReader()); | 95 return read_until_end(original.clone().body.getReader()); |
| 96 }).then(function(chunks) { | 96 }).then(function(chunks) { |
| 97 for (var chunk of chunks) { | 97 for (var chunk of chunks) { |
| 98 read += chunk.byteLength; | 98 read += chunk.byteLength; |
| 99 } | 99 } |
| 100 // Make sure that we received all data in total. | 100 // Make sure that we received all data in total. |
| 101 assert_equals(read, 190); | 101 assert_equals(read, 190); |
| 102 }); | 102 }); |
| 103 }, 'Clone after reading partially'); | 103 }, 'Clone after reading partially'); |
| 104 | 104 |
| 105 sequential_promise_test(function(t) { | |
| 106 var read = 0; | |
|
tyoshino (SeeGerritForStatus)
2015/03/23 03:57:21
remove
yhirano
2015/03/23 05:47:31
Reverted
| |
| 107 var original; | |
| 108 return fetch('/fetch/resources/progressive.php').then(function(res) { | |
| 109 res.body.cancel(); | |
| 110 return res.text(); | |
| 111 }).then(function(text) { | |
| 112 assert_equals(text, ''); | |
| 113 }); | |
| 114 }, 'Cancelling stream stops downloading.'); | |
| 115 | |
| 105 sequential_promise_test_done(); | 116 sequential_promise_test_done(); |
| 106 done(); | 117 done(); |
| OLD | NEW |