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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/streams/readable-streams/bad-strategies.js

Issue 2808853003: Remove Blink copies of readable-streams layout tests (Closed)
Patch Set: Restore rs-utils.js as it is used by fetch tests Created 3 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
Index: third_party/WebKit/LayoutTests/http/tests/streams/readable-streams/bad-strategies.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/streams/readable-streams/bad-strategies.js b/third_party/WebKit/LayoutTests/http/tests/streams/readable-streams/bad-strategies.js
deleted file mode 100644
index a186a7bea4c9d2ee2342f01e8acd76152ad9bff5..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/streams/readable-streams/bad-strategies.js
+++ /dev/null
@@ -1,175 +0,0 @@
-'use strict';
-
-if (self.importScripts) {
- self.importScripts('/resources/testharness.js');
-}
-
-test(() => {
-
- const theError = new Error('a unique string');
-
- assert_throws(theError, () => {
- new ReadableStream({}, {
- get size() {
- throw theError;
- },
- highWaterMark: 5
- });
- }, 'construction should re-throw the error');
-
-}, 'Readable stream: throwing strategy.size getter');
-
-promise_test(t => {
-
- const controllerError = { name: 'controller error' };
- const thrownError = { name: 'thrown error' };
-
- let controller;
- const rs = new ReadableStream(
- {
- start(c) {
- controller = c;
- }
- },
- {
- size() {
- controller.error(controllerError);
- throw thrownError;
- },
- highWaterMark: 5
- }
- );
-
- assert_throws(thrownError, () => controller.enqueue('a'), 'enqueue should re-throw the error');
-
- return promise_rejects(t, controllerError, rs.getReader().closed);
-
-}, 'Readable stream: strategy.size errors the stream and then throws');
-
-promise_test(t => {
-
- const theError = { name: 'my error' };
-
- let controller;
- const rs = new ReadableStream(
- {
- start(c) {
- controller = c;
- }
- },
- {
- size() {
- controller.error(theError);
- return Infinity;
- },
- highWaterMark: 5
- }
- );
-
- assert_throws(new RangeError(), () => controller.enqueue('a'), 'enqueue should throw a RangeError');
-
- return promise_rejects(t, theError, rs.getReader().closed, 'closed should reject with the error');
-
-}, 'Readable stream: strategy.size errors the stream and then returns Infinity');
-
-promise_test(() => {
-
- const theError = new Error('a unique string');
- const rs = new ReadableStream(
- {
- start(c) {
- assert_throws(theError, () => c.enqueue('a'), 'enqueue should throw the error');
- }
- },
- {
- size() {
- throw theError;
- },
- highWaterMark: 5
- }
- );
-
- return rs.getReader().closed.catch(e => {
- assert_equals(e, theError, 'closed should reject with the error');
- });
-
-}, 'Readable stream: throwing strategy.size method');
-
-test(() => {
-
- const theError = new Error('a unique string');
-
- assert_throws(theError, () => {
- new ReadableStream({}, {
- size() {
- return 1;
- },
- get highWaterMark() {
- throw theError;
- }
- });
- }, 'construction should re-throw the error');
-
-}, 'Readable stream: throwing strategy.highWaterMark getter');
-
-test(() => {
-
- for (const highWaterMark of [-1, -Infinity]) {
- assert_throws(new RangeError(), () => {
- new ReadableStream({}, {
- size() {
- return 1;
- },
- highWaterMark
- });
- }, 'construction should throw a RangeError for ' + highWaterMark);
- }
-
- for (const highWaterMark of [NaN, 'foo', {}]) {
- assert_throws(new RangeError(), () => {
- new ReadableStream({}, {
- size() {
- return 1;
- },
- highWaterMark
- });
- }, 'construction should throw a RangeError for ' + highWaterMark);
- }
-
-}, 'Readable stream: invalid strategy.highWaterMark');
-
-promise_test(() => {
-
- const promises = [];
- for (const size of [NaN, -Infinity, Infinity, -1]) {
- let theError;
- const rs = new ReadableStream(
- {
- start(c) {
- try {
- c.enqueue('hi');
- assert_unreached('enqueue didn\'t throw');
- } catch (error) {
- assert_equals(error.name, 'RangeError', 'enqueue should throw a RangeError for ' + size);
- theError = error;
- }
- }
- },
- {
- size() {
- return size;
- },
- highWaterMark: 5
- }
- );
-
- promises.push(rs.getReader().closed.catch(e => {
- assert_equals(e, theError, 'closed should reject with the error for ' + size);
- }));
- }
-
- return Promise.all(promises);
-
-}, 'Readable stream: invalid strategy.size return value');
-
-done();

Powered by Google App Engine
This is Rietveld 408576698