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

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

Issue 1018243002: [Fetch] Support various operations after reading data partially. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@async-read
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/modules/fetch/Body.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/fetch/script-tests/stream-reader.js
diff --git a/LayoutTests/http/tests/fetch/script-tests/stream-reader.js b/LayoutTests/http/tests/fetch/script-tests/stream-reader.js
index 32fe577b453956a13037d32f5307eefebc3a6fbd..0923257df66d81ab9e9e7d4100ce52ab1ecfed5a 100644
--- a/LayoutTests/http/tests/fetch/script-tests/stream-reader.js
+++ b/LayoutTests/http/tests/fetch/script-tests/stream-reader.js
@@ -75,5 +75,31 @@ sequential_promise_test(function(t) {
});
}, 'Setting bodyUsed means the body is locked.');
+sequential_promise_test(function(t) {
+ var reader;
+ var read = 0;
+ var original;
+ return fetch('/fetch/resources/progressive.php').then(function(res) {
+ original = res;
+ reader = res.body.getReader();
+ return reader.read();
+ }).then(function(r) {
+ assert_false(r.done);
+ read += r.value.byteLength;
+ // Make sure that we received something but we didn't receive all.
+ assert_not_equals(read, 0);
+ assert_not_equals(read, 190);
+
+ reader.releaseLock();
+ return read_until_end(original.clone().body.getReader());
+ }).then(function(chunks) {
+ for (var chunk of chunks) {
+ read += chunk.byteLength;
+ }
+ // Make sure that we received all data in total.
+ assert_equals(read, 190);
+ });
+ }, 'Clone after reading partially');
+
sequential_promise_test_done();
done();
« no previous file with comments | « no previous file | Source/modules/fetch/Body.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698