Bug 1611717 [wpt PR 21428] - [UA client hints] Align implementation with PR#46, #48 & #70, a=testonly

Automatic update from web-platform-tests
[UA client hints] Align implementation with PR#46, #48 & #70

This CL aligns the UA-CH implementation with PR#46[1], #48[2] and
#70[3].

[1] https://github.com/WICG/ua-client-hints/pull/46
[2] https://github.com/WICG/ua-client-hints/pull/48
[3] https://github.com/WICG/ua-client-hints/pull/70

Change-Id: I8221d8a967213180a1aa1d9ef23f17e6f95718b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2019369
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: Aaron Tagliaboschi <aarontag@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747644}

--

wpt-commits: e0be414fa1d9f3b4e841ca74bfc43ee3d7586fc4
wpt-pr: 21428
This commit is contained in:
Yoav Weiss 2020-03-09 21:44:33 +00:00 коммит произвёл moz-wptsync-bot
Родитель a48ab2c43c
Коммит fbe15a191b
3 изменённых файлов: 29 добавлений и 22 удалений

Просмотреть файл

@ -5,7 +5,7 @@ def main(request, response):
response.headers.set("Accept-CH-Lifetime", "10")
response.content = '''
<script>
window.opener.postMessage({ header: "%s" }, "*");
window.opener.postMessage({ header: '%s' }, "*");
</script>
Sec-CH-UA: %s
''' % (ua, ua)

Просмотреть файл

@ -0,0 +1,28 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webrtc/dictionary-helper.js"></script>
<script>
test(t => {
assert_true("userAgentData" in navigator);
}, "navigator.getUserAgent() is exposed.");
promise_test(async t => {
const uaData = navigator.userAgentData;
for (ua of uaData.uaList) {
assert_equals(typeof ua.brand, "string", "brand should be a string");
assert_equals(typeof ua.version, "string", "version should be a string");
}
assert_equals(typeof uaData.mobile, "boolean", "mobile should be a boolean");
const highEntropyData = await uaData.getHighEntropyValues(["platform", "platformVersion", "architecture", "model"]);
assert_equals(typeof highEntropyData["platform"], "string", "Platform brand should be a string");
assert_equals(typeof highEntropyData["platformVersion"], "string", "Platform version should be a string");
assert_equals(typeof highEntropyData["architecture"], "string", "Architecture should be a string");
assert_equals(typeof highEntropyData["model"], "string", "Model should be a string");
const highEntropyData2 = await uaData.getHighEntropyValues([]);
assert_equals(highEntropyData2["platform"], "", "Platform brand should be an empty string");
assert_equals(highEntropyData2["platformVersion"], "", "Platform version should be an empty string");
assert_equals(highEntropyData2["architecture"], "", "Architecture should be an empty string");
assert_equals(highEntropyData2["model"], "", "Model should be an empty string");
}, "navigator.getUserAgent() returns a UserAgentMetadata object.");
</script>

Просмотреть файл

@ -1,21 +0,0 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webrtc/dictionary-helper.js"></script>
<script>
test(t => {
assert_true("getUserAgent" in navigator);
}, "navigator.getUserAgent() is exposed.");
promise_test(t => {
return navigator.getUserAgent()
.then(ua => {
// TODO(web-platform-tests/wpt#9106): Use `idlharness.js` once it supports dictionaries.
assert_string_field(ua, "brand");
assert_string_field(ua, "version");
assert_string_field(ua, "platform");
assert_string_field(ua, "architecture");
assert_string_field(ua, "model");
});
}, "navigator.getUserAgent() returns a UserAgentMetadata object.");
</script>