forked from mykmelez/gecko
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1561129 [wpt PR 17443] - KV Storage: update to match IDL, a=testonly
Automatic update from web-platform-tests KV Storage: update to match IDL Along with https://chromium-review.googlesource.com/c/chromium/src/+/1670572, this aligns the KV Storage implementation with WICG/kv-storage#68, which uses Web IDL to define the API. The observable changes are to: * Enumerability of methods * Adding @@toStringTag (affecting Object.prototype.toString.call) This includes web platform tests that abuse the current idlharness.js infrastructure, plus some ad-hoc hand-written tests that we expect to be generated by future versions of idlharness.js once the relevant Web IDL pull requests are merged. It removes the existing API surface tests and helpers in favor of idlharness.js. Bug: 931263 Change-Id: I9205d1a8b3040617cbb6200f825ba9ad250e61c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1672137 Commit-Queue: Domenic Denicola <domenic@chromium.org> Reviewed-by: Joshua Bell <jsbell@chromium.org> Cr-Commit-Position: refs/heads/master@{#671975} -- wpt-commits: 72da3e36e3657a358c4e74b495e582262b40a016 wpt-pr: 17443
- Loading branch information
Showing
9 changed files
with
236 additions
and
239 deletions.
There are no files selected for viewing
70 changes: 0 additions & 70 deletions
70
testing/web-platform/tests/kv-storage/api-surface.https.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 0 additions & 139 deletions
139
testing/web-platform/tests/kv-storage/helpers/class-assert.js
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
testing/web-platform/tests/kv-storage/helpers/expose-as-global.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Helper file to be loaded in an iframe that exposes a copy of StorageArea as a global</title> | ||
|
||
<script type="module"> | ||
import { StorageArea } from "std:kv-storage"; | ||
window.StorageArea = StorageArea; | ||
</script> |
42 changes: 42 additions & 0 deletions
42
testing/web-platform/tests/kv-storage/helpers/iter-assert.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
export function iterResultCustom(o, expectedValue, expectedDone, valueAsserter, label) { | ||
label = formatLabel(label); | ||
|
||
assert_equals(typeof expectedDone, "boolean", | ||
`${label} iterResult assert usage check: expectedDone must be a boolean`); | ||
|
||
propertyKeys(o, ["value", "done"], [], label); | ||
assert_equals(Object.getPrototypeOf(o), Object.prototype, `${label}prototype must be Object.prototype`); | ||
valueAsserter(o.value, expectedValue, `${label}value`); | ||
assert_equals(o.done, expectedDone, `${label}done`); | ||
} | ||
|
||
export function iterResult(o, expectedValue, expectedDone, label) { | ||
return iterResultCustom(o, expectedValue, expectedDone, assert_equals, label); | ||
} | ||
|
||
export function iterResultsCustom(actualArray, expectedArrayOfArrays, valueAsserter, label) { | ||
label = formatLabel(label); | ||
|
||
assert_equals(actualArray.length, expectedArrayOfArrays.length, | ||
`${label} iterResults assert usage check: actual and expected must have the same length`); | ||
|
||
for (let i = 0; i < actualArray.length; ++i) { | ||
const [expectedValue, expectedDone] = expectedArrayOfArrays[i]; | ||
iterResultCustom(actualArray[i], expectedValue, expectedDone, valueAsserter, `${label}iter result ${i}`); | ||
} | ||
} | ||
|
||
export function iterResults(actualArray, expectedArrayOfArrays, label) { | ||
return iterResultsCustom(actualArray, expectedArrayOfArrays, assert_equals, label); | ||
} | ||
|
||
function propertyKeys(o, expectedNames, expectedSymbols, label) { | ||
label = formatLabel(label); | ||
assert_array_equals(Object.getOwnPropertyNames(o), expectedNames, `${label}property names`); | ||
assert_array_equals(Object.getOwnPropertySymbols(o), expectedSymbols, | ||
`${label}property symbols`); | ||
} | ||
|
||
function formatLabel(label) { | ||
return label !== undefined ? `${label} ` : ""; | ||
} |
Oops, something went wrong.