chromium/third_party/blink/web_tests/http/tests/cache/location-reload.html

<!DOCYUPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>

async_test(t => {
  let testWindow = null;
  let messageCount = 0;

  // Test will run on testWindow that is opened below.
  // This page just received messages to confirm if tests run expectedly.
  const checkReady = e => {
    t.step(() => {
      // Will receive "READY" twice because of a reload, then receive "PASS".
      assert_equals(e.data, "READY", "received message is " + e.data);
      messageCount++;

      if (messageCount == 2) {
        window.removeEventListener("message", checkReady, false);
        window.addEventListener("message", e => {
          assert_equals(e.data, "PASS", "received message is " + e.data);
          t.done();
        }, { once: true });
      }

      // Send back "START" message for "READY".
      assert_class_string(testWindow, "Window", "testWindow is invalid");
      testWindow.postMessage("START", location.origin);
    });
  };
  window.addEventListener("message", checkReady, false);

  // Start a test in a dedicated window because we can not track navigations
  // within a test harness.
  t.step(() => {
    testWindow = open("./resources/location-reload-window.html", "testWindow");
    assert_class_string(testWindow, "Window", "window.open() failed");
  });
}, "Test location.reload() cache behaviors");
</script>