Bug 1527719 [wpt PR 15359] - KV storage: make backingStore return the same frozen object, a=testonly

Automatic update from web-platform-tests
KV storage: make backingStore return the same frozen object

Follows https://github.com/WICG/kv-storage/pull/51.

Bug: 931263
Change-Id: Ia3b1482093bfaca443b8809c6e284397fdb6fec1
Reviewed-on: https://chromium-review.googlesource.com/c/1466863
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632657}

--

wpt-commits: 14b470e2e03c1e792bef6e2fafbc244b78af9f3b
wpt-pr: 15359
This commit is contained in:
Domenic Denicola 2019-03-05 12:17:23 +00:00 committed by James Graham
parent 5bb6c9fee7
commit 1cc16d1241
2 changed files with 33 additions and 13 deletions

View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>KV Storage: backingStore getter</title>
<!-- See https://github.com/WICG/kv-storage/issues/45 -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="module">
import { storage } from "std:kv-storage";
test(() => {
assert_equals(storage.backingStore, storage.backingStore);
}, "backingStore must return the same object each time");
test(() => {
assert_true(Object.isFrozen(storage.backingStore));
}, "backingStore must be a frozen object");
test(() => {
const { backingStore } = storage;
assert_array_equals(Object.keys(backingStore), ["database", "store", "version"], "property names");
assert_array_equals(Object.getOwnPropertySymbols(backingStore), [], "no symbols")
assert_own_property(backingStore, "database");
assert_own_property(backingStore, "store");
assert_own_property(backingStore, "version");
assert_equals(Object.getPrototypeOf(backingStore), Object.prototype);
assert_equals(backingStore.database, "kv-storage:default");
assert_equals(backingStore.store, "store");
assert_equals(backingStore.version, 1);
}, "backingStore object must have the right shape");
</script>

View File

@ -9,19 +9,6 @@
import { testVariousMethodsWithDefaultArea } from "./helpers/kvs-tests.js";
import { storage } from "std:kv-storage";
test(() => {
const { backingStore } = storage;
assert_array_equals(Object.keys(backingStore), ["database", "store", "version"]);
assert_own_property(backingStore, "database");
assert_own_property(backingStore, "store");
assert_own_property(backingStore, "version");
assert_equals(Object.getPrototypeOf(backingStore), Object.prototype);
assert_equals(backingStore.database, "kv-storage:default");
assert_equals(backingStore.store, "store");
assert_equals(backingStore.version, 1);
}, "backingStore returns the correct object");
testVariousMethodsWithDefaultArea(
"Storage methods smoke test with string key and value", "key", "value", assert_equals
);