From b705a29e70cb0e98d20ee597f67070699994af51 Mon Sep 17 00:00:00 2001 From: Marijn Kruisselbrink Date: Thu, 9 Jul 2020 14:17:48 +0000 Subject: [PATCH] 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 Commit-Queue: Victor Costan Reviewed-by: Victor Costan Cr-Commit-Position: refs/heads/master@{#786059} -- wpt-commits: d40dbb507b4b7bcc061e811fb03aa6afba111a05 wpt-pr: 24505 --- .../script-tests/FileSystemWritableFileStream-write.js | 2 ++ .../script-tests/FileSystemWritableFileStream.js | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-write.js b/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-write.js index 516894bcf956..c49f0f62848d 100644 --- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-write.js +++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-write.js @@ -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'])); diff --git a/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream.js b/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream.js index 778437e2a592..1cebb993556f 100644 --- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream.js +++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream.js @@ -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');