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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-stream-construction.js

Issue 1969333002: [Fetch API] |(new Response(stream)).body| should return |stream| (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/Source/core/streams/ReadableStream.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file contains tests for Response construction with a readable stream. 1 // This file contains tests for Response construction with a readable stream.
2 // Move these tests to response.js once the feature gets stable. 2 // Move these tests to response.js once the feature gets stable.
3 3
4 if (self.importScripts) { 4 if (self.importScripts) {
5 importScripts('../resources/fetch-test-helpers.js'); 5 importScripts('../resources/fetch-test-helpers.js');
6 importScripts('/streams/resources/rs-utils.js'); 6 importScripts('/streams/resources/rs-utils.js');
7 } 7 }
8 8
9 test(() => { 9 test(() => {
10 var controller; 10 var controller;
11 var stream = new ReadableStream({start: c => controller = c}); 11 var stream = new ReadableStream({start: c => controller = c});
12 12
13 var response = new Response(stream); 13 var response = new Response(stream);
14 // TODO(yhirano): This should be assert_equals. 14 assert_equals(response.body, stream);
15 assert_not_equals(response.body, stream);
16 }, 'Response constructed with a stream'); 15 }, 'Response constructed with a stream');
17 16
18 promise_test(() => { 17 promise_test(() => {
19 var controller; 18 var controller;
20 var stream = new ReadableStream({start: c => controller = c}); 19 var stream = new ReadableStream({start: c => controller = c});
21 controller.enqueue(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f])); 20 controller.enqueue(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f]));
22 controller.enqueue(new Uint8Array([0x77, 0x6f, 0x72, 0x6c, 0x64])); 21 controller.enqueue(new Uint8Array([0x77, 0x6f, 0x72, 0x6c, 0x64]));
23 controller.close(); 22 controller.close();
24 assert_false(stream.locked); 23 assert_false(stream.locked);
25 var response = new Response(stream); 24 var response = new Response(stream);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 86
88 promise_test(t => { 87 promise_test(t => {
89 var controller; 88 var controller;
90 var stream = new ReadableStream({start: c => controller = c}); 89 var stream = new ReadableStream({start: c => controller = c});
91 setTimeout(() => controller.enqueue('hello'), 1); 90 setTimeout(() => controller.enqueue('hello'), 1);
92 var response = new Response(stream); 91 var response = new Response(stream);
93 return promise_rejects(t, TypeError(), response.text()); 92 return promise_rejects(t, TypeError(), response.text());
94 }, 'Response constructed stream with a string chunk'); 93 }, 'Response constructed stream with a string chunk');
95 94
96 done(); 95 done();
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/streams/ReadableStream.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698