fune/testing/web-platform/tests/file-system-access/showSaveFilePicker-manual.https.html
Austin Sullivan b09d32745d Bug 1689708 [wpt PR 27396] - Refactor native_file_system -> file_system_access in wpt, a=testonly
Automatic update from web-platform-tests
Refactor native_file_system -> file_system_access in wpt

Bug: 110509
Change-Id: I5c4c32e731e8aeecc9a2bfb5b60ee12ebb76f59a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2643042
Commit-Queue: Austin Sullivan <asully@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#850164}

--

wpt-commits: 489679e4fccedcb37ae4d3e028b5d1a56adbc769
wpt-pr: 27396
2021-02-08 22:55:38 +00:00

33 lines
1.3 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/test-helpers.js"></script>
<script>
promise_test(async t => {
await window.test_driver.bless(
'show a file picker.<br />Please make a copy of file-system-access/resources/data/testfile.txt in a writable directory and pick that file');
const file = await self.showSaveFilePicker({
multiple: false, types: [
{ description: 'Text files', accept: { 'text/plain': ['.txt'] } },
],
});
assert_true(file instanceof FileSystemHandle);
assert_true(file instanceof FileSystemFileHandle);
assert_equals(file.kind, "file");
assert_equals(file.name, 'testfile.txt');
assert_equals(await (await file.getFile()).text(), '',
'showSaveFilePicker should clear contents of file');
promise_test(async t => {
assert_equals(await file.queryPermission(), 'granted');
assert_equals(await file.queryPermission({ mode: 'readwrite' }), 'granted');
}, 'showSaveFilePicker returns correct permissions');
}, 'showSaveFilePicker works');
</script>