summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/ua-client-hints/useragentdata.https.any.js
blob: fa588355181a18f9413f1d13129d1f991837e316 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// META: title=tests for navigator.userAgentData

test(t => {
  const brands = navigator.userAgentData.brands;
  assert_true(brands.every(brand => brand.brand.length < 32),
    "No brand should be longer than 32 characters.");
});

test(t => {
  const uaData = navigator.userAgentData.toJSON();
  assert_own_property(uaData, "brands", "toJSON() output has brands member");
  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.");