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(); |