Files
tubestation/testing/web-platform/tests/client-hints/accept-ch-cache-revalidation.https.html
Yoav Weiss b23a00dc5d Bug 1634942 [wpt PR 23376] - [ua-ch] Add support for Sec-CH-UA-Platform-Version, a=testonly
Automatic update from web-platform-tests
[ua-ch] Add support for Sec-CH-UA-Platform-Version

The platform version was split out of the Sec-CH-UA-Platform header[1],
but the Client Hint version of it wasn't implemented.
This CL fixes that.

[1] https://github.com/WICG/ua-client-hints/pull/64

Bug: 1076933
Change-Id: I6670673c160f88e5df22814b36b327711c2529a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2172308
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Aaron Tagliaboschi <aarontag@chromium.org>
Reviewed-by: Maksim Orlovich <morlovich@chromium.org>
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765459}

--

wpt-commits: 31c87db730fd5ad74f9cda802ca572345557ff2c
wpt-pr: 23376
2020-05-20 10:28:12 +00:00

52 lines
1.5 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<title>Tests Stale While Revalidate is not executed for fetch API</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script>
function wait25ms(test) {
return new Promise(resolve => {
test.step_timeout(() => {
resolve();
}, 25);
});
}
promise_test(async (test) => {
var request_token = token();
var client_hint_headers = [
"device-memory",
"dpr",
"width",
"viewport-width",
"rtt",
"downlink",
"ect",
"sec-ch-lang",
"sec-ch-ua",
"sec-ch-ua-arch",
"sec-ch-ua-platform",
"sec-ch-ua-platform-version",
"sec-ch-ua-model",
"sec-ch-ua-mobile",
];
const response = await fetch(`resources/stale-echo-client-hints.py?token=` + request_token);
const response2 = await fetch(`resources/stale-echo-client-hints.py?token=` + request_token);
assert_equals(response.headers.get('Unique-Id'), response2.headers.get('Unique-Id'));
while(true) {
const revalidation_check = await fetch(`resources/stale-echo-client-hints.py?query&token=` + request_token);
if (revalidation_check.headers.get('Count') == '2') {
client_hint_headers.forEach(header => {
assert_equals(revalidation_check.headers.get(header+"-recieved"), revalidation_check.headers.get(header+"-previous"));
});
break;
}
await wait25ms(test);
}
}, 'Same headers sent for revalidation request');
</script>