Skip to content

Commit

Permalink
FSA: Fix file cleanup code in WPTs
Browse files Browse the repository at this point in the history
Recently attempted to add cleanup code to these tests but the cleanup
code was incorrect. The tests continued to pass so it wasn't caught by
the CQ.

This fixes the cleanup code.

Bug: 363601806
Change-Id: Ice9f23cc1400854002c3e9b4f3a45ce11dbc0cc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5846508
Reviewed-by: Christine Hollingsworth <[email protected]>
Commit-Queue: Nathan Memmott <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1353627}
  • Loading branch information
Nathan Memmott authored and chromium-wpt-export-bot committed Sep 10, 2024
1 parent e32d138 commit fa10aa8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions file-system-access/getDirectory.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@

promise_test(async t => {
const fileName = 'testFile';
const directory = await navigator.storage.getDirectory();

t.add_cleanup(async () => {
try {
await parent.removeEntry(fileName);
await directory.removeEntry(fileName);
} catch {
// Ignore any errors in case the test failed.
}
});

const directory = await navigator.storage.getDirectory();
return directory.getFileHandle(fileName, {create: true});
}, 'Call getFileHandle successfully');

promise_test(async t => {
const directoryName = 'testDirectory';
const directory = await navigator.storage.getDirectory();

t.add_cleanup(async () => {
try {
await parent.removeEntry(fileName, {recursive: true});
await directory.removeEntry(directoryName, {recursive: true});
} catch {
// Ignore any errors in case the test failed.
}
});

const directory = await navigator.storage.getDirectory();
return directory.getDirectoryHandle(directoryName, {create: true});
}, 'Call getDirectoryHandle successfully');

0 comments on commit fa10aa8

Please sign in to comment.