Skip to content

Commit

Permalink
Test that userAgentData.architecture is one of two allowed values.
Browse files Browse the repository at this point in the history
See https://wicg.github.io/ua-client-hints/#ref-for-user-agent-platform-architecture

Change-Id: Icf2ab2195a99ae9463865a78837cc108de3d4eed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3970607
Commit-Queue: Mike Taylor <[email protected]>
Reviewed-by: Victor Tan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1062263}
  • Loading branch information
miketaylr authored and chromium-wpt-export-bot committed Oct 21, 2022
1 parent e26f46e commit 2768d78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ua-client-hints/useragentdata.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ test(t => {
assert_own_property(uaData, "mobile", "toJSON() output has mobile member");
assert_own_property(uaData, "platform", "toJSON() output has platform member");
}, "test NavigatorUAData.toJSON() output");

promise_test(() => {
return navigator.userAgentData.getHighEntropyValues(["architecture"]).then(
hints => assert_true(["x86", "arm"].some(item => item == hints.architecture))
);
}, "Arch should be one of two permitted values.");
3 changes: 3 additions & 0 deletions workers/WorkerNavigator_userAgentData.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
assert_equals(e.data.architecture, highEntropyValues.architecture);
assert_equals(e.data.uaFullVersion, highEntropyValues.uaFullVersion);
assert_equals(e.data.NavigatorUADataExposed, true);

// Architecture should be one of two permitted values.
assert_true(["x86", "arm"].some(arch => arch == e.data.architecture))
}, "Test that userAgentData is available in workers in secure contexts");
</script>

0 comments on commit 2768d78

Please sign in to comment.