Update web-platform-tests to revision e87f38097902e16348d4e17f4fe3bc2d0112bff1

This commit is contained in:
WPT Sync Bot 2018-03-17 21:12:30 -04:00
parent 2f8fa32e91
commit db5631a086
381 changed files with 11610 additions and 4232 deletions

View file

@ -0,0 +1,33 @@
<html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// When the response for the HTML file contains "Accept-CH" in the response
// headers, then the browser should not attach the specified client hints in
// the HTTP request headers if the response was delivered by an insecure HTTP
// server. Test this functionality by fetching an XHR from this page hosted on
// an insecure HTTP server. The response headers for this page include
// "Accept-CH: device-memory, dpr, viewport-width".
//
// echo_client_hints_received.py includes "device-memory-received",
// "dpr-received" and "viewport-width-received" in the response headers
// depending on the set of client hints it receives in the request headers.
promise_test(t => {
return fetch("/client-hints/echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser does not include client hints in the headers
// when fetching the XHR from an insecure HTTP server.
assert_false(r.headers.has("device-memory-received"));
assert_false(r.headers.has("dpr-received"));
assert_false(r.headers.has("viewport-width-received"));
});
}, "Accept-CH header test");
</script>
</body>
</html>

View file

@ -0,0 +1 @@
Accept-CH: device-memory, dpr, viewport-width

View file

@ -1,30 +0,0 @@
<html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// If the response for the HTML file contains "Accept-CH: device-memory" in
// the response headers, then the browser should attach device-memory client
// hint in the HTTP request headers. Test this functionality by fetching an
// XHR from this page. The response headers for this page include
// "Accept-CH: device-memory".
//
// echo_device_memory_header_received.py includes "device-memory-received" in
// the response headers only if the request included "device-memory" in the
// headers.
promise_test(t => {
return fetch("/client-hints/echo_device_memory_header_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser included "device-memory" in the headers when
// fetching the XHR.
assert_true(r.headers.has("device-memory-received"));
});
}, "Accept-CH header test");
</script>
</body>
</html>

View file

@ -1 +0,0 @@
Accept-CH: device-memory

View file

@ -0,0 +1,32 @@
<html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// If the response for the HTML file contains "Accept-CH" in the response
// headers, then the browser should attach the specified client hints in the
// HTTP request headers. Test this functionality by fetching an
// XHR from this page. The response headers for this page include
// "Accept-CH: device-memory, dpr, viewport-width".
//
// echo_client_hints_received.py includes "device-memory-received",
// "dpr-received" and "viewport-width-received" in the response headers
// depending on the set of client hints it receives in the request headers.
promise_test(t => {
return fetch("https://{{domains[]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py", {"mode": "no-cors"}).then(r => {
assert_equals(r.status, 200)
// Verify that the browser includes client hints in the headers when
// fetching the XHR.
assert_true(r.headers.has("device-memory-received"), "device-memory-received");
assert_true(r.headers.has("dpr-received"), "dpr-received");
assert_true(r.headers.has("viewport-width-received"), "viewport-width-received");
});
}, "Accept-CH header test");
</script>
</body>
</html>

View file

@ -0,0 +1 @@
Accept-CH: device-memory, dpr, viewport-width

View file

@ -5,4 +5,8 @@ def main(request, response):
"""
if "device-memory" in request.headers:
response.headers.set("device-memory-received", "true")
response.headers.set("device-memory-received", "true")
if "dpr" in request.headers:
response.headers.set("dpr-received", "true")
if "viewport-width" in request.headers:
response.headers.set("viewport-width-received", "true")