Bug 1651238 [wpt PR 24505] - [NativeFS] Add some assertions for the locked state of streams., a=testonly

Automatic update from web-platform-tests
[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: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786059}

--

wpt-commits: d40dbb507b4b7bcc061e811fb03aa6afba111a05
wpt-pr: 24505
This commit is contained in:
Marijn Kruisselbrink 2020-07-09 14:17:48 +00:00 коммит произвёл moz-wptsync-bot
Родитель 190ff358df
Коммит b705a29e70
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -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');