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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/close.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/close.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/close.js b/third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/close.js
index bb63c62cdbba5a030a3a33aa313498ceeaf8326d..fb155237937f11031dac184055dfee1ad52d55bd 100644
--- a/third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/close.js
+++ b/third_party/WebKit/LayoutTests/http/tests/streams/writable-streams/close.js
@@ -32,9 +32,8 @@ promise_test(t => {
const writer = ws.getWriter();
- writer.close();
-
return Promise.all([
+ writer.close(),
delay(10).then(() => controller.error(passedError)),
promise_rejects(t, passedError, writer.closed,
'closed promise should be rejected with the passed error'),
@@ -52,8 +51,7 @@ promise_test(t => {
const writer = ws.getWriter();
- return promise_rejects(t, passedError, writer.close(), 'close promise should be rejected with the passed error')
- .then(() => promise_rejects(t, passedError, writer.closed, 'closed should stay rejected'));
+ return writer.close().then(() => promise_rejects(t, passedError, writer.closed, 'closed should stay rejected'));
}, 'when sink calls error synchronously while closing, the stream should become errored');
promise_test(() => {
@@ -140,4 +138,36 @@ promise_test(t => {
return promise_rejects(t, rejection, ws.getWriter().close(), 'close() should return a rejection');
}, 'returning a thenable from close() should work');
+promise_test(t => {
+ const ws = new WritableStream();
+ const writer = ws.getWriter();
+ return writer.ready.then(() => {
+ const closePromise = writer.close();
+ const closedPromise = writer.closed;
+ writer.releaseLock();
+ return Promise.all([
+ closePromise,
+ promise_rejects(t, new TypeError(), closedPromise, '.closed promise should be rejected')
+ ]);
+ });
+}, 'releaseLock() should not change the result of sync close()');
+
+promise_test(t => {
+ const ws = new WritableStream({
+ close() {
+ return flushAsyncEvents();
+ }
+ });
+ const writer = ws.getWriter();
+ return writer.ready.then(() => {
+ const closePromise = writer.close();
+ const closedPromise = writer.closed;
+ writer.releaseLock();
+ return Promise.all([
+ closePromise,
+ promise_rejects(t, new TypeError(), closedPromise, '.closed promise should be rejected')
+ ]);
+ });
+}, 'releaseLock() should not change the result of async close()');
+
done();

Powered by Google App Engine
This is Rietveld 408576698