| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <body> | 4 <body> |
| 5 <!-- The following script's response contains an Accept-CH header, and there
fore must be synchronous | 5 <!-- The following script's response contains an Accept-CH header, and there
fore must be synchronous |
| 6 for the purpose of this test --> | 6 for the purpose of this test --> |
| 7 <script src="../resources/accept-ch.php"></script> | 7 <script src="../resources/accept-ch.php"></script> |
| 8 <script> | 8 <script> |
| 9 var t = async_test('Client-Hints not sent when Accept-CH header is prese
nt only in subresource'); | 9 var t = async_test('Client-Hints not sent when Accept-CH header is prese
nt only in subresource'); |
| 10 var body = document.body; | 10 var body = document.body; |
| 11 var unreached = function() { | 11 var unreached = function() { |
| 12 assert_unreached("Image should not have loaded."); | 12 assert_unreached("Image should not have loaded."); |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 var loadDeviceRAMImage = function() { |
| 16 var img = new Image(); |
| 17 img.src = 'resources/image-checks-for-device-ram.php'; |
| 18 img.onload = t.step_func(unreached); |
| 19 img.onerror = t.step_func(function(){ t.done(); }); |
| 20 body.appendChild(img); |
| 21 }; |
| 15 var loadRWImage = function() { | 22 var loadRWImage = function() { |
| 16 var img = new Image(); | 23 var img = new Image(); |
| 17 img.src = 'resources/image-checks-for-width.php'; | 24 img.src = 'resources/image-checks-for-width.php'; |
| 18 img.onload = t.step_func(unreached); | 25 img.onload = t.step_func(unreached); |
| 19 img.onerror = t.step_func(function(){ t.done(); }); | 26 img.onerror = t.step_func(loadDeviceRAMImage); |
| 20 body.appendChild(img); | 27 body.appendChild(img); |
| 21 }; | 28 }; |
| 22 t.step(function() { | 29 t.step(function() { |
| 23 var img = new Image(); | 30 var img = new Image(); |
| 24 img.src = 'resources/image-checks-for-dpr.php'; | 31 img.src = 'resources/image-checks-for-dpr.php'; |
| 25 img.onload = t.step_func(unreached); | 32 img.onload = t.step_func(unreached); |
| 26 img.onerror = t.step_func(loadRWImage); | 33 img.onerror = t.step_func(loadRWImage); |
| 27 body.appendChild(img); | 34 body.appendChild(img); |
| 28 }); | 35 }); |
| 29 </script> | 36 </script> |
| 30 </body> | 37 </body> |
| OLD | NEW |