chromium/third_party/blink/web_tests/fast/dom/HTMLImageElement/image-srcset-react-to-media-changes.html

<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<script>
var jsTestIsAsync = true;
var img;

onload = function() {
    var iframe = document.getElementById('frame');
    var iframeDoc = iframe.contentWindow.document;

    iframeDoc.body.innerHTML = '<img id="srcset" srcset="resources/blue_rect.jpg 90w, resources/image-set-4x.png 120w">';

    img = iframeDoc.getElementById('srcset');

    var first = true;
    img.onload = function() {
        if (first) {
            first = false;
            shouldNotBe('img.currentSrc.indexOf("blue_rect")', '-1');
            iframe.style.width = '120px';
        } else {
            shouldNotBe('img.currentSrc.indexOf("image-set-4x")', '-1');
            finishJSTest();
        }
    };
    img.onerror = function() {
        testFailed('Image should have loaded');
    };
}
</script>

<iframe id="frame" style="width: 80px;"></iframe>