gecko-dev/testing/web-platform/tests/streams/writable-streams/byte-length-queuing-strategy.any.js
Jason Orendorff 47519c94b2 Bug 1513570 - Part 1: Adapt stream tests to run in the shell. r=Ms2ger
We don't support byte streams, transform streams, writable streams, or piping
yet, but we will, and in the meantime our own meta files disable those tests
for us.

Differential Revision: https://phabricator.services.mozilla.com/D14314

--HG--
extra : moz-landing-system : lando
2018-12-14 18:14:56 +00:00

28 lines
705 B
JavaScript

// META: global=worker,jsshell
'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');