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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/v8-extra-body.js

Issue 1827373002: Add another body function returning a V8 Extra ReadableStream to Response (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | third_party/WebKit/LayoutTests/http/tests/fetch/serviceworker/v8-extra-body.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/v8-extra-body.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/v8-extra-body.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/v8-extra-body.js
new file mode 100644
index 0000000000000000000000000000000000000000..bf49ee19edea91eb3c5dd58df3644f99c0493ae9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/v8-extra-body.js
@@ -0,0 +1,24 @@
+if (self.importScripts) {
+ importScripts('/fetch/resources/fetch-test-helpers.js');
+ importScripts('/streams/resources/rs-utils.js');
+}
+
+promise_test(t => {
+ return fetch('/fetch/resources/doctype.html').then(res => {
+ var stream = res.v8ExtraStreamBody();
+ assert_equals(stream.constructor, ReadableStream, 'stream type');
+ var reader = stream.getReader();
+ return readableStreamToArray(stream, reader);
+ }).then(chunks => {
+ var decoder = new TextDecoder();
+ var result = '';
+ for (var chunk of chunks) {
+ assert_equals(chunk.constructor, Uint8Array, 'chunk type');
+ result += decoder.decode(chunk, {stream: true});
+ }
+ result += decoder.decode(new Uint8Array(0), {stream: false});
+ assert_equals(result, '<!DOCTYPE html>\n');
+ });
+ }, 'read contents via v8ExtraStreamBody');
+
+done();
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/fetch/serviceworker/v8-extra-body.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698