Commit e62f453c authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

[NativeFS] Add some assertions for the locked state of streams.

https://github.com/WICG/native-file-system/issues/194 suggests there
might be something weird going here, so add assertions to the tests to
make sure locked has the value we expect it to have.

Change-Id: Ia13251aeeb16734047a2f5abe7e61d7fd4bbeb0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285293
Auto-Submit: Marijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786059}
parent 8ff10dd3
......@@ -295,7 +295,9 @@ directory_test(async (t, root) => {
directory_test(async (t, root) => {
const handle = await createEmptyFile(t, 'writer_written', root);
const stream = await handle.createWritable();
assert_false(stream.locked);
const writer = stream.getWriter();
assert_true(stream.locked);
await writer.write('foo');
await writer.write(new Blob(['bar']));
......
......@@ -104,14 +104,20 @@ directory_test(async (t, root) => {
directory_test(async (t, root) => {
const handle = await createEmptyFile(t, 'contents', root);
const stream = await handle.createWritable();
assert_false(stream.locked);
stream.write('abc');
assert_false(stream.locked);
stream.write('def');
assert_false(stream.locked);
stream.truncate(9);
assert_false(stream.locked);
stream.seek(0);
assert_false(stream.locked);
stream.write('xyz');
assert_false(stream.locked);
await stream.close();
assert_equals(await getFileContents(handle), 'xyzdef\0\0\0');
assert_equals(await getFileSize(handle), 9);
}, 'commands are queued');
}, 'commands are queued, stream is unlocked after each operation');
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment