chromium/third_party/blink/web_tests/http/tests/misc/client-hint-accept-on-subresource.html

<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body>
    <!-- The following script's response contains an Accept-CH header, and therefore must be synchronous
         for the purpose of this test -->
    <script src="../resources/accept-ch.php"></script>
    <script>
        var t = async_test('Client-Hints not sent when Accept-CH header is present only in subresource');
        var body = document.body;
        var unreached = function() {
            assert_unreached("Image should not have loaded.");
        };

        var loadDeviceMemoryImage = function() {
            var img = new Image();
            img.src = 'resources/image-checks-for-device-memory.php';
            img.onload = t.step_func(unreached);
            img.onerror = t.step_func(function(){ t.done(); });
            body.appendChild(img);
        };
        var loadRWImage = function() {
            var img = new Image();
            img.src = 'resources/image-checks-for-width.php';
            img.onload = t.step_func(unreached);
            img.onerror = t.step_func(loadDeviceMemoryImage);
            body.appendChild(img);
        };
        t.step(function() {
            var img = new Image();
            img.src = 'resources/image-checks-for-dpr.php';
            img.onload = t.step_func(unreached);
            img.onerror = t.step_func(loadRWImage);
            body.appendChild(img);
        });
    </script>
</body>