Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / misc / client-hints-accept.php
blob72f78b09b45224b02d7bbaca669823511d8703bb
1 <?php
2 header("ACCEPT-CH: DPR, Width, Viewport-Width");
3 ?>
4 <!DOCTYPE html>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 <body>
8 <script>
9 var t = async_test('Client-Hints sent when Accept-CH header is present');
10 var unreached = function() {
11 assert_unreached("Image should have loaded.");
14 var loadRWImage = function() {
15 var img = new Image();
16 img.src = 'resources/image-checks-for-width.php';
17 img.sizes = '500';
18 img.onload = t.step_func(function(){ t.done(); });
19 img.onerror = t.step_func(unreached);
20 document.body.appendChild(img);
22 var loadViewportImage = function() {
23 var img = new Image();
24 img.src = 'resources/image-checks-for-viewport-width.php';
25 img.onload = t.step_func(loadRWImage);
26 img.onerror = t.step_func(unreached);
27 document.body.appendChild(img);
29 t.step(function() {
30 var img = new Image();
31 img.src = 'resources/image-checks-for-dpr.php';
32 img.onload = t.step_func(loadViewportImage);
33 img.onerror = t.step_func(unreached);
34 document.body.appendChild(img);
35 });
36 </script>
37 </body>