chromium/third_party/blink/web_tests/fast/history/window-open.html

<script>
    var childWindow;
</script>
<p>
    Test for <i><a href="rdar://problem/6550530">rdar://problem/6550530</a> REGRESSION (r40508): Window opened with window.open has no initial history item (global and back/forward)</i>.
</p>
<button id="button" onclick="childWindow = window.open('resources/window-open-window.html')">
    Click here to open a new window
</button>
<p>
    The most recent item in global history should be <i>window-open-window.html</i>.
</p>
<p id="result">
</p>
<script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.keepWebHistory();
        testRunner.waitUntilDone();
        testRunner.setPopupBlockingEnabled(false);
        document.getElementById("result").innerText = "FAIL: Test did not complete";
        var button = document.getElementById("button");
        eventSender.mouseMoveTo(button.offsetParent.offsetLeft + button.offsetLeft + button.offsetWidth / 2, button.offsetParent.offsetTop +  button.offsetTop + button.offsetHeight / 2);
        eventSender.mouseDown();
        eventSender.mouseUp();
    }

    function childLoaded()
    {
        childWindow.close();
        if (window.testRunner) {
            document.getElementById("result").innerText = testRunner.webHistoryItemCount === 1 ? "PASS" : "FAIL";
            testRunner.notifyDone();
        }
    }
</script>