Bug 1643025 [wpt PR 23946] - Iterate sorted keys when comparing keyframes for testing, a=testonly

Automatic update from web-platform-tests
Iterate sorted keys when comparing keyframes for testing

Since enumeration does not guarantee any specific order, we can get
test failures when the order changes for an unrelated reason
(typically when adding a new CSS property).

Fix by sorting the keys before comparing, which ensures that we fail
the same way every time.

Change-Id: I7bbc8e98bc17120084c6934d71f092ee0ba016da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2228724
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774670}

--

wpt-commits: 5c06da35ce8006aec00019449edbe352fa8bc593
wpt-pr: 23946
This commit is contained in:
Anders Hartvoll Ruud 2020-06-10 11:25:54 +00:00 committed by moz-wptsync-bot
parent 06968e7e8b
commit 3e9d7d8038
2 changed files with 4 additions and 2 deletions

View File

@ -48,7 +48,8 @@ function assert_frames_equal(actual, expected, name) {
`properties on ${name} should match`
);
for (const prop in actual) {
// Iterates sorted keys to ensure stable failures.
for (const prop of Object.keys(actual).sort()) {
if (
// 'offset' can be null
(prop === 'offset' && typeof actual[prop] === 'number') ||

View File

@ -28,7 +28,8 @@ function assert_frames_equal(a, b, name) {
assert_equals(Object.keys(a).sort().toString(),
Object.keys(b).sort().toString(),
`properties on ${name} should match`);
for (const p in a) {
// Iterates sorted keys to ensure stable failures.
for (const p of Object.keys(a).sort()) {
assert_equals(a[p], b[p], `value for '${p}' on ${name}`);
}
}