Skip to content

Commit

Permalink
External WPT tests for Client hints
Browse files Browse the repository at this point in the history
Bug:817049
Change-Id: Id74193ab7a1cc3c4b03d66e080c43c64a6fcfbb2
  • Loading branch information
tarunban authored and chromium-wpt-export-bot committed Mar 8, 2018
1 parent fbf57c4 commit bdfff81
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions client_hints/accept_ch.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<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>
1 change: 1 addition & 0 deletions client_hints/accept_ch.https.html.headers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Accept-CH: device-memory

0 comments on commit bdfff81

Please sign in to comment.