summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/storage/storagemanager-estimate.https.any.js
blob: 3b6f4d8edc4c2e51d6e9efbc2a2929e75d6b6725 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// META: title=StorageManager: estimate()

test(t => {
  assert_true('estimate' in navigator.storage);
  assert_equals(typeof navigator.storage.estimate, 'function');
  assert_true(navigator.storage.estimate() instanceof Promise);
}, 'estimate() method exists and returns a Promise');

promise_test(async t => {
  const result = await navigator.storage.estimate();
  assert_equals(typeof result, 'object');
  assert_true('usage' in result);
  assert_equals(typeof result.usage, 'number');
  assert_true('quota' in result);
  assert_equals(typeof result.quota, 'number');
}, 'estimate() resolves to dictionary with members');