chromium/third_party/blink/web_tests/fast/events/click-svganchor-blur-refocus-window.html

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>This test ensures that the focus ring is shown on the only anchor after tabbing out and inside the window.</p>
<p><svg width="500" height="30"><a id="anchor" xlink:href="javascript:log('anchor was clicked')"><text font-size="18px" y="20">Anchor</text></a></svg></p>
<input id="input">
<pre id="console">
</pre>

<script>
var anchor = document.getElementById('anchor');
var input = document.getElementById('input');
window.onfocus = function() {
    log('window was focused');
};
window.onblur = function() {
    log('window was blurred');
};
anchor.onfocus = function() {
    log('anchor was focused');
};
anchor.onblur = function() {
    log('anchor was blurred');
};
input.onfocus = function() {
    log('input was focused');
};
input.onblur = function() {
    log('input was blurred');
};
window.onload = function() {
    if (window.eventSender) {
        // Click the link.
        var anchorRect = anchor.getBoundingClientRect();
        eventSender.mouseMoveTo(anchorRect.left + 2, anchorRect.top + 2);
        eventSender.mouseDown();
        eventSender.mouseUp();
        // Shift focus to input element.
        eventSender.keyDown('\t');
        internals.setFocused(false);
        testRunner.overridePreference('WebKitTabToLinksPreferenceKey', true);
        // Set focus to the anchor.
        internals.setInitialFocus(false);
        // Upon focus, the default focus ring should be displayed because the
        // focus was triggered by the keyboard (tab).
        internals.setFocused(true);
    }
};

function log(message) {
    var console = document.getElementById("console");
    console.textContent += message + '\n';
}
</script>
</body>
</html>