| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="resources/simple-queue-common.js"></script> |
| <script> |
| promise_test(t => { |
| let lastChunk; |
| const ws = new WritableStream({ |
| write(chunk) { |
| lastChunk = chunk; |
| } |
| }); |
| const writer = ws.getWriter(); |
| let lastPromise; |
| // All chunks will be queued. |
| for (let i = 0; i < QUEUE_MAX_ARRAY_SIZE; ++i) { |
| lastPromise = writer.write(i); |
| } |
| assert_equals(undefined, lastChunk, |
| 'underlying sink write() should not have been called yet'); |
| return lastPromise.then(() => { |
| assert_equals(QUEUE_MAX_ARRAY_SIZE - 1, lastChunk, |
| 'lastChunk should equal QUEUE_MAX_ARRAY_SIZE - 1'); |
| }); |
| }, 'shift() should work when exactly one full node exists'); |
| </script> |