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(); |