diff --git a/fs/resources/test-helpers.js b/fs/resources/test-helpers.js index f185e2f48b6e791..4bcf5d7e8341e22 100644 --- a/fs/resources/test-helpers.js +++ b/fs/resources/test-helpers.js @@ -17,13 +17,9 @@ const LOCK_ACCESS = { }; // Array of separators used to separate components in hierarchical paths. -let kPathSeparators; -if (navigator.userAgent.includes('Windows NT')) { - // Windows uses both '/' and '\' as path separators. - kPathSeparators = ['/', '\\']; -} else { - kPathSeparators = ['/']; -} +// Consider both '/' and '\' as path separators to ensure file names are +// platform-agnostic. +let kPathSeparators = ['/', '\\']; async function getFileSize(handle) { const file = await handle.getFile(); diff --git a/fs/script-tests/FileSystemFileHandle-move.js b/fs/script-tests/FileSystemFileHandle-move.js index dd848626e4a747f..c5d08f305d06123 100644 --- a/fs/script-tests/FileSystemFileHandle-move.js +++ b/fs/script-tests/FileSystemFileHandle-move.js @@ -50,25 +50,15 @@ directory_test(async (t, root) => { assert_array_equals(await getSortedDirectoryEntries(root), ['file-1']); }, 'move(name) can be called multiple times'); -directory_test(async (t, root) => { - const dir = await root.getDirectoryHandle('dir', {create: true}); - const handle = await createFileWithContents(t, 'file-before', 'foo', dir); - await promise_rejects_js(t, TypeError, handle.move('Lorem.')); - - assert_array_equals(await getSortedDirectoryEntries(root), ['dir/']); - assert_array_equals(await getSortedDirectoryEntries(dir), ['file-before']); - assert_equals(await getFileContents(handle), 'foo'); - assert_equals(await getFileSize(handle), 3); -}, 'move(name) with a name with a trailing period should fail'); - directory_test(async (t, root) => { const handle = await createFileWithContents(t, 'file-before', 'foo', root); await promise_rejects_js(t, TypeError, handle.move('test/test')); + await promise_rejects_js(t, TypeError, handle.move('test\\test')); assert_array_equals(await getSortedDirectoryEntries(root), ['file-before']); assert_equals(await getFileContents(handle), 'foo'); assert_equals(await getFileSize(handle), 3); -}, 'move(name) with a name with invalid characters should fail'); +}, 'move(name) with a name with path separators should fail'); directory_test(async (t, root) => { const handle = await createFileWithContents(t, 'file-before', 'abc', root);