chromium/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-location-replace-set-src.html

<!DOCTYPE html>
<title>Navigating iframe loading='lazy' and then setting src: location.replace</title>
<iframe data-src="support/blank.htm?nav" loading="lazy" hidden></iframe>
<script>
const iframe = document.querySelector('iframe');
const iframeLoaded = new Promise(resolve => {
  iframe.onload = resolve;
});
iframe.contentWindow.location.replace(iframe.dataset.src);
// Setting src invokes https://html.spec.whatwg.org/C#process-the-iframe-attributes
iframe.src = 'support/blank.htm?src';
iframe.hidden = false;
</script>
<!-- Loading testharness.js here is intentional to reproduce a bug in WebKit. -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({single_test: true});
iframeLoaded.then(() => {
  // Need a timeout to detect failure when there are two navigations.
  step_timeout(() => {
    assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?src", location.href).href);
    done();
  }, 1000);
});
</script>