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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/constructor.js

Issue 2596883002: Update writable streams for the latest spec changes (Closed)
Patch Set: Adjust indents Created 3 years, 11 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/writable-streams/constructor.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/constructor.js b/third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/constructor.js
index 70be3c5c8be39662f04bf075dd04bfbe0498e2f9..dc2bef9a1dfbbf11b49939ab87ee05178767ae54 100644
--- a/third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/constructor.js
+++ b/third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/constructor.js
@@ -4,6 +4,9 @@ if (self.importScripts) {
self.importScripts('/resources/testharness.js');
}
+const error1 = new Error('error1');
+error1.name = 'error1';
+
promise_test(() => {
let controller;
const ws = new WritableStream({
@@ -13,41 +16,44 @@ promise_test(() => {
});
// Now error the stream after its construction.
- const passedError = new Error('horrible things');
- controller.error(passedError);
+ controller.error(error1);
const writer = ws.getWriter();
assert_equals(writer.desiredSize, null, 'desiredSize should be null');
return writer.closed.catch(r => {
- assert_equals(r, passedError, 'ws should be errored by passedError');
+ assert_equals(r, error1, 'ws should be errored by the passed error');
});
}, 'controller argument should be passed to start method');
promise_test(t => {
const ws = new WritableStream({
write(chunk, controller) {
- controller.error(new Error());
+ controller.error(error1);
}
});
const writer = ws.getWriter();
- writer.write('a');
- return promise_rejects(t, new Error(), writer.closed, 'controller.error() in write() should errored the stream');
+ return Promise.all([
+ writer.write('a'),
+ promise_rejects(t, error1, writer.closed, 'controller.error() in write() should errored the stream')
+ ]);
}, 'controller argument should be passed to write method');
promise_test(t => {
const ws = new WritableStream({
close(controller) {
- controller.error(new Error());
+ controller.error(error1);
}
});
const writer = ws.getWriter();
- writer.close();
- return promise_rejects(t, new Error(), writer.closed, 'controller.error() in close() should error the stream');
+ return Promise.all([
+ writer.close(),
+ promise_rejects(t, error1, writer.closed, 'controller.error() in close() should error the stream')
+ ]);
}, 'controller argument should be passed to close method');
promise_test(() => {
@@ -126,7 +132,7 @@ test(() => {
assert_throws(new TypeError(), () => new WritableStreamDefaultController(stream),
'constructor should throw a TypeError exception');
-}, 'WritableStreamDefaultController constructor should throw when passed an initalised WritableStream');
+}, 'WritableStreamDefaultController constructor should throw when passed an initialised WritableStream');
test(() => {
const stream = new WritableStream();

Powered by Google App Engine
This is Rietveld 408576698