mirror of
https://github.com/servo/servo.git
synced 2025-06-27 10:33:39 +01:00
25 lines
874 B
JavaScript
25 lines
874 B
JavaScript
// META: title=NativeIO API: File deletion is reflected in listing.
|
|
// META: global=window,worker
|
|
|
|
'use strict';
|
|
|
|
promise_test(async testCase => {
|
|
const file = await nativeIO.open('test_file');
|
|
testCase.add_cleanup(async () => {
|
|
await nativeIO.delete('test_file');
|
|
});
|
|
await file.close();
|
|
|
|
const fileNamesBeforeDelete = await nativeIO.getAll();
|
|
assert_in_array('test_file', fileNamesBeforeDelete);
|
|
|
|
await nativeIO.delete('test_file');
|
|
const fileNames = await nativeIO.getAll();
|
|
assert_equals(fileNames.indexOf('test_file'), -1);
|
|
}, 'nativeIO.getAll does not return file deleted by nativeIO.delete');
|
|
|
|
promise_test(async testCase => {
|
|
await nativeIO.delete('test_file');
|
|
// Delete a second time if the file existed before the first delete.
|
|
await nativeIO.delete('test_file');
|
|
}, 'nativeIO.delete does not fail when deleting a non-existing file');
|