chromium/third_party/blink/web_tests/fast/events/check-defocus-event-order-when-triggered-by-tab.html

<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/record-events.js"></script>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

window.onload = runTest;

function runTest()
{
    if (!window.eventSender)
        return;

    var firstInput = document.getElementById("firstInput");
    var secondInput = document.getElementById("secondInput");
    registerElementsAndEventsToRecord([firstInput, secondInput], ["focus", "blur", "change", "click"]);

    beginRecordingEvents();
    firstInput.focus();
    eventSender.keyDown("A");
    eventSender.keyDown("\t"); // Transfers focus to text field "second input".
    endRecordingEvents();
    checkThatEventsFiredInOrder([["firstInput", "focus"], ["firstInput", "change"], ["firstInput", "blur"], ["secondInput", "focus"]]);
    debug('<br /><span class="pass">TEST COMPLETE</span>');
}
</script>
</head>
<body>
<p id="description"></p>
<div id="test-container">
    <input type="text" id="firstInput" placeholder="first input" />
    <input type="text" id="secondInput" placeholder="second input" />
</div>
<div id="console"></div>
<script>
    description("This test checks that when a user focuses on the &quot;first input&quot; text field, modifies its contents, and then " +
                "defocuses it by pressing the tab key that the following DOM events are fired in order: Focus, Change, Blur, Focus " +
                "(on &quot;second input&quot;). Note, this test must be run by Dump Render Tree.");
</script>
</body>
</html>