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

Side by Side Diff: LayoutTests/http/tests/fetch/script-tests/stream-reader.js

Issue 1028913002: ReadableStream.cancel's parameter should be optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 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
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();
OLDNEW
« no previous file with comments | « no previous file | Source/core/streams/ReadableStream.h » ('j') | Source/core/streams/ReadableStream.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698