Skip to content

Commit

Permalink
webrtc wpt: add test for stats consistency
Browse files Browse the repository at this point in the history
checking that each stat.someId resolves in the stats map

BUG=None

Change-Id: Id4083209f00c3866352177058db8a01d0244b59c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5317644
Reviewed-by: Harald Alvestrand <[email protected]>
Commit-Queue: Philipp Hancke <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1265062}
  • Loading branch information
fippo authored and chromium-wpt-export-bot committed Feb 26, 2024
1 parent d6804a0 commit 2294a96
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions webrtc-stats/supported-stats.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@
]);
const stats = await getAllStats(t, pc1);

// The focus of this test is that there are no dangling references,
// i.e. keys ending with `Id` as described in
// https://w3c.github.io/webrtc-stats/#guidelines-for-design-of-stats-objects
test(t => {
for (const stat of stats.values()) {
Object.keys(stat).forEach(key => {
if (!key.endsWith('Id')) return;
assert_true(stats.has(stat[key]), `${stat.type}.${key} can be resolved`);
});
}
}, 'All references resolve');

// The focus of this test is not API correctness, but rather to provide an
// accessible metric of implementation progress by dictionary member. We count
// whether we've seen each dictionary's members in getStats().
Expand Down

0 comments on commit 2294a96

Please sign in to comment.