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 0720d0f71340860f8dedba260fcacdf239ac3c41..9225a3c43134129ba24f43e5ef7a27bf8703e22e 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(); |