Automatic update from web-platform-tests FSA: Fix file cleanup code in WPTs 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 <christinesm@chromium.org> Commit-Queue: Nathan Memmott <memmott@chromium.org> Cr-Commit-Position: refs/heads/main@{#1353627} -- wpt-commits: fa10aa8d9de06b5db6f21a720d2b4677817c8aa7 wpt-pr: 48088
33 lines
885 B
JavaScript
33 lines
885 B
JavaScript
// META: global=window,worker
|
|
// META: script=resources/test-helpers.js
|
|
|
|
promise_test(async t => {
|
|
const fileName = 'testFile';
|
|
const directory = await navigator.storage.getDirectory();
|
|
|
|
t.add_cleanup(async () => {
|
|
try {
|
|
await directory.removeEntry(fileName);
|
|
} catch {
|
|
// Ignore any errors in case the test failed.
|
|
}
|
|
});
|
|
|
|
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 directory.removeEntry(directoryName, {recursive: true});
|
|
} catch {
|
|
// Ignore any errors in case the test failed.
|
|
}
|
|
});
|
|
|
|
return directory.getDirectoryHandle(directoryName, {create: true});
|
|
}, 'Call getDirectoryHandle successfully');
|