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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 if (self.importScripts) {
2 importScripts('/fetch/resources/fetch-test-helpers.js');
3 importScripts('/streams/resources/rs-utils.js');
4 }
5
6 promise_test(t => {
7 return fetch('/fetch/resources/doctype.html').then(res => {
8 var stream = res.v8ExtraStreamBody();
9 assert_equals(stream.constructor, ReadableStream, 'stream type');
10 var reader = stream.getReader();
11 return readableStreamToArray(stream, reader);
12 }).then(chunks => {
13 var decoder = new TextDecoder();
14 var result = '';
15 for (var chunk of chunks) {
16 assert_equals(chunk.constructor, Uint8Array, 'chunk type');
17 result += decoder.decode(chunk, {stream: true});
18 }
19 result += decoder.decode(new Uint8Array(0), {stream: false});
20 assert_equals(result, '<!DOCTYPE html>\n');
21 });
22 }, 'read contents via v8ExtraStreamBody');
23
24 done();
OLDNEW
« 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