blob: 42791a3b770c8b5a7375521c450a45937a829b0f [file] [log] [blame] [edit]
<html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/feature-policy-navigation.js"></script>
<script>
(async () => {
await test_frame(
"HTTPS_REMOTE_ORIGIN",
"sec-ch-device-memory=false&device-memory=false&sec-ch-dpr=false&dpr=false&sec-ch-viewport-width=false&viewport-width=false&sec-ch-ua=true&sec-ch-ua-mobile=true",
"",
"Client hints not loaded on cross-origin iframe request with no feature policy.");
await test_frame(
"HTTPS_ORIGIN",
"sec-ch-device-memory=true&device-memory=true&sec-ch-dpr=true&dpr=true&sec-ch-viewport-width=true&viewport-width=true&sec-ch-ua=true&sec-ch-ua-mobile=true",
"",
"Client hints loaded on same-origin iframe request with no feature policy.");
let allow = "ch-device-memory *; ch-dpr 'src'; ch-viewport-width 'self'; ch-prefers-color-scheme 'none'";
await test_frame(
"HTTPS_REMOTE_ORIGIN",
"sec-ch-device-memory=true&device-memory=true&sec-ch-dpr=true&dpr=true&sec-ch-viewport-width=false&viewport-width=false&sec-ch-ua=true&sec-ch-ua-mobile=true",
allow,
"Client hints loaded on cross-origin iframe request with allow list.");
await test_frame(
"HTTPS_ORIGIN",
"sec-ch-device-memory=true&device-memory=true&sec-ch-dpr=true&dpr=true&sec-ch-viewport-width=true&viewport-width=true&sec-ch-ua=true&sec-ch-ua-mobile=true",
allow,
"Client hints loaded on same-origin iframe request with allow list.");
})();
</script>
</body>
</html>