From 59a9f7feef50988f44c2f7e384687b9bef6dd5b1 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Thu, 28 Oct 2021 10:28:39 +0000 Subject: [PATCH] Bug 1737699 [wpt PR 31381] - Update Sec-CH-UA tests: fix existing tests, and test brand size., a=testonly Automatic update from web-platform-tests Update Sec-CH-UA tests: fix existing tests, and test brand size. As of https://github.com/WICG/ua-client-hints/issues/179, https://wicg.github.io/ua-client-hints/#user-agent-brand now requires that a brand in a brand list not be longer than 32 bytes. This CL adds a new test for the userAgentData.brands interface, and modifies the existing sec-ch-ua HTTP tests. Also, the existing sec-ch-ua HTTP tests were updated to more closely reflect the current state of UA-CH ("UA" is not a valid token, and "Accept-CH-Lifetime" is not shipping). Bug: 1263180 Change-Id: Ifa7cbf18d67271e2dd1dc1d485f432d4ca9327fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3243544 Commit-Queue: Aaron Tagliaboschi Auto-Submit: Mike Taylor Reviewed-by: Aaron Tagliaboschi Cr-Commit-Position: refs/heads/main@{#935138} -- wpt-commits: c1be1a0eea9b45e6aa3ee088f76aee7955092693 wpt-pr: 31381 --- .../tests/client-hints/resources/sec-ch-ua.py | 4 +- .../tests/client-hints/sec-ch-ua.https.html | 51 +++++++++++-------- .../useragentdata.https.any.js | 7 +++ 3 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 testing/web-platform/tests/ua-client-hints/useragentdata.https.any.js diff --git a/testing/web-platform/tests/client-hints/resources/sec-ch-ua.py b/testing/web-platform/tests/client-hints/resources/sec-ch-ua.py index 01bcb9682a1ae..ddeb582a19bc8 100644 --- a/testing/web-platform/tests/client-hints/resources/sec-ch-ua.py +++ b/testing/web-platform/tests/client-hints/resources/sec-ch-ua.py @@ -1,8 +1,6 @@ def main(request, response): - ua = request.headers.get(b'sec-ch-ua', b'') + ua = request.headers.get(b'Sec-CH-UA', b'') response.headers.set(b"Content-Type", b"text/html") - response.headers.set(b"Accept-CH", b"UA") - response.headers.set(b"Accept-CH-Lifetime", b"10") response.content = b''' diff --git a/testing/web-platform/tests/ua-client-hints/useragentdata.https.any.js b/testing/web-platform/tests/ua-client-hints/useragentdata.https.any.js new file mode 100644 index 0000000000000..fc1e9e0b3c989 --- /dev/null +++ b/testing/web-platform/tests/ua-client-hints/useragentdata.https.any.js @@ -0,0 +1,7 @@ +// 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."); +});