chromium/third_party/blink/web_tests/fast/dom/icon-url-list-viewport.html

<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" type="image/x-icon" href="http://test.com/favicon.ico"/>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>

function addFavIcon(iconURL, media) {
    var docHead = document.getElementsByTagName("head")[0];
    var link = document.createElement("link");
    link.type = "image/x-icon";
    link.rel = "shortcut icon";
    link.href = iconURL;
    link.media = media;
    docHead.appendChild(link);
}

window.onload = function() {
  promise_test(async () => {
    addFavIcon(
      "http://test.com/mediafavicon1.ico",
      `(max-width: ${window.outerWidth + 1}px)`
    );
    addFavIcon(
      "http://test.com/mediafavicon2.ico",
      `(max-width: ${window.outerWidth - 1}px)`
    );

    var expectedURLs = [
      "http://test.com/mediafavicon1.ico",
      "http://test.com/favicon.ico",
    ];
    assert_array_equals(
      internals.shortcutIconURLs(document),
      expectedURLs,
      "URL list does not match expected"
    );

    var resizePromise = new Promise(resolve => window.onresize = resolve);
    window.resizeBy(-24, 0);
    await resizePromise;

    var expectedURLs = [
      "http://test.com/mediafavicon2.ico",
      "http://test.com/mediafavicon1.ico",
      "http://test.com/favicon.ico",
    ];
    assert_array_equals(
      internals.shortcutIconURLs(document),
      expectedURLs,
      "URL list does not match expected"
    );
  });
};
</script>
</head>
</html>