diff options
Diffstat (limited to 'testing/web-platform/tests/streams/writable-streams/byte-length-queuing-strategy.any.js')
-rw-r--r-- | testing/web-platform/tests/streams/writable-streams/byte-length-queuing-strategy.any.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/testing/web-platform/tests/streams/writable-streams/byte-length-queuing-strategy.any.js b/testing/web-platform/tests/streams/writable-streams/byte-length-queuing-strategy.any.js new file mode 100644 index 0000000000..ce1962e891 --- /dev/null +++ b/testing/web-platform/tests/streams/writable-streams/byte-length-queuing-strategy.any.js @@ -0,0 +1,28 @@ +// META: global=window,worker +'use strict'; + +promise_test(t => { + let isDone = false; + const ws = new WritableStream( + { + write() { + return new Promise(resolve => { + t.step_timeout(() => { + isDone = true; + resolve(); + }, 200); + }); + }, + + close() { + assert_true(isDone, 'close is only called once the promise has been resolved'); + } + }, + new ByteLengthQueuingStrategy({ highWaterMark: 1024 * 16 }) + ); + + const writer = ws.getWriter(); + writer.write({ byteLength: 1024 }); + + return writer.close(); +}, 'Closing a writable stream with in-flight writes below the high water mark delays the close call properly'); |