summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fs/script-tests/FileSystemBaseHandle-buckets.js
blob: 98261995f9659b939027d914d9f9ce0d3c2a980e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';

directory_test(async (t, root_dir) => {
  const inboxBucket = await navigator.storageBuckets.open('inbox');
  const inboxRootDir = await inboxBucket.getDirectory();

  assert_false(await inboxRootDir.isSameEntry(root_dir));

  const handle1 = await createEmptyFile(t, 'mtime.txt', inboxRootDir);
  const handle2 = await inboxRootDir.getFileHandle('mtime.txt');
  assert_true(await handle1.isSameEntry(handle2));
}, 'isSameEntry works as expected with buckets');

directory_test(async (t, root_dir) => {
  const inboxBucket = await navigator.storageBuckets.open('inbox');
  await navigator.storageBuckets.delete('inbox');
  const directoryPromise = inboxBucket.getDirectory();
  await promise_rejects_dom(t, 'InvalidStateError', directoryPromise);
}, 'getDirectory promise rejects if bucket has been deleted');