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

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

Issue 2675163003: Merge response-stream-construction.js to response.js (Closed)
Patch Set: Created 3 years, 10 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
Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-stream-construction.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-stream-construction.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-stream-construction.js
deleted file mode 100644
index 86d51ba2d22bb5e019de10a92ee7d590adb206e7..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/response-stream-construction.js
+++ /dev/null
@@ -1,95 +0,0 @@
-// This file contains tests for Response construction with a readable stream.
-// Move these tests to response.js once the feature gets stable.
-
-if (self.importScripts) {
- importScripts('../resources/fetch-test-helpers.js');
- importScripts('/streams/resources/rs-utils.js');
-}
-
-test(() => {
- var controller;
- var stream = new ReadableStream({start: c => controller = c});
-
- var response = new Response(stream);
- assert_equals(response.body, stream);
- }, 'Response constructed with a stream');
-
-promise_test(() => {
- var controller;
- var stream = new ReadableStream({start: c => controller = c});
- controller.enqueue(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f]));
- controller.enqueue(new Uint8Array([0x77, 0x6f, 0x72, 0x6c, 0x64]));
- controller.close();
- assert_false(stream.locked);
- var response = new Response(stream);
- var p = response.text().then(t => {
- assert_equals(t, 'helloworld');
- });
- assert_true(stream.locked);
- return p;
- }, 'Response constructed with a stream');
-
-promise_test(() => {
- var controller;
- var stream = new ReadableStream({start: c => controller = c});
- controller.enqueue(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f]));
- controller.enqueue(new Uint8Array([0x77, 0x6f, 0x72, 0x6c, 0x64]));
- controller.close();
-
- var response = new Response(stream);
- return readableStreamToArray(response.body).then(chunks => {
- var decoder = new TextDecoder('utf-8');
- var r = '';
- for (var chunk of chunks) {
- r += decoder.decode(chunk, {stream: true});
- }
- r += decoder.decode();
- assert_equals(r, 'helloworld');
- });
- }, 'Response constructed with a stream / Read from body stream');
-
-promise_test(t => {
- var controller;
- var stream = new ReadableStream({start: c => controller = c});
- setTimeout(() => {
- controller.enqueue(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f]));
- controller.enqueue(new Uint8Array([0x77, 0x6f, 0x72, 0x6c, 0x64]));
- controller.error();
- }, 1);
- var response = new Response(stream);
- return promise_rejects(t, TypeError(), response.text());
- }, 'Response constructed with an errored stream');
-
-promise_test(t => {
- var controller;
- var stream = new ReadableStream({start: c => controller = c});
- stream.getReader();
- var response = new Response(stream);
- return promise_rejects(t, TypeError(), response.text());
- }, 'Response constructed with a locked stream');
-
-promise_test(t => {
- var controller;
- var stream = new ReadableStream({start: c => controller = c});
- setTimeout(() => controller.enqueue(), 1);
- var response = new Response(stream);
- return promise_rejects(t, TypeError(), response.text());
- }, 'Response constructed stream with an undefined chunk');
-
-promise_test(t => {
- var controller;
- var stream = new ReadableStream({start: c => controller = c});
- setTimeout(() => controller.enqueue(null), 1);
- var response = new Response(stream);
- return promise_rejects(t, TypeError(), response.text());
- }, 'Response constructed stream with a null chunk');
-
-promise_test(t => {
- var controller;
- var stream = new ReadableStream({start: c => controller = c});
- setTimeout(() => controller.enqueue('hello'), 1);
- var response = new Response(stream);
- return promise_rejects(t, TypeError(), response.text());
- }, 'Response constructed stream with a string chunk');
-
-done();

Powered by Google App Engine
This is Rietveld 408576698