OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta http-equiv="Accept-CH" content="DPR, RW"> | 2 <meta http-equiv="Accept-CH" content="DPR, Width, Viewport-Width"> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <body> | 5 <body> |
6 <script> | 6 <script> |
7 var t = async_test('Client-Hints sent when Accept-CH header is present')
; | 7 var t = async_test('Client-Hints sent when Accept-CH header is present')
; |
8 var unreached = function() { | 8 var unreached = function() { |
9 assert_unreached("Image should have loaded."); | 9 assert_unreached("Image should have loaded."); |
10 }; | 10 }; |
11 | 11 |
12 var loadRWImage = function() { | 12 var loadRWImage = function() { |
13 var img = new Image(); | 13 var img = new Image(); |
14 img.src = 'resources/image-checks-for-rw.php'; | 14 img.src = 'resources/image-checks-for-width.php'; |
15 img.onload = t.step_func(function(){ t.done(); }); | 15 img.onload = t.step_func(function(){ t.done(); }); |
16 img.onerror = t.step_func(unreached); | 16 img.onerror = t.step_func(unreached); |
17 document.body.appendChild(img); | 17 document.body.appendChild(img); |
18 }; | 18 }; |
| 19 var loadViewportImage = function() { |
| 20 var img = new Image(); |
| 21 img.src = 'resources/image-checks-for-viewport-width.php'; |
| 22 img.onload = t.step_func(loadRWImage); |
| 23 img.onerror = t.step_func(unreached); |
| 24 document.body.appendChild(img); |
| 25 }; |
19 t.step(function() { | 26 t.step(function() { |
20 var img = new Image(); | 27 var img = new Image(); |
21 img.src = 'resources/image-checks-for-dpr.php'; | 28 img.src = 'resources/image-checks-for-dpr.php'; |
22 img.onload = t.step_func(loadRWImage); | 29 img.onload = t.step_func(loadViewportImage); |
23 img.onerror = t.step_func(unreached); | 30 img.onerror = t.step_func(unreached); |
24 document.body.appendChild(img); | 31 document.body.appendChild(img); |
25 }); | 32 }); |
26 </script> | 33 </script> |
27 </body> | 34 </body> |
OLD | NEW |