chromium/third_party/blink/web_tests/fast/events/key-events-in-input-button.html

<p>To test manually, press keys and compare results to other browsers.</p>
<input type="button" value="Input"
   onclick="log(eventInfo(event));"
   onmousedown="log(eventInfo(event));"
   onmouseup="log(eventInfo(event));"
   onkeypress="log(eventInfo(event));"
   onkeydown="log(eventInfo(event));"
   onkeyup="log(eventInfo(event));">
</input>
<div id="log"></div>

<script>
function log(msg) {
   document.getElementById("log").innerHTML+= msg + "<br />";
}
function eventInfo(event, where) {
  try {
  if (!event)
    event = window.event;
    target = event.srcElement ? event.srcElement : event.target;
    if (event.type == "textInput")
        return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type + " - " + event.data;
    else if (event.type == "keydown" || event.type == "keypress" || event.type == "keyup") 
        return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type
            + ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKey]
            + ' -' + event.key
            + '- ' + event.keyCode
            + ' - ' + event.charCode;
    else if (event.type == "mousedown" || event.type == "click" || event.type == "mouseup")
        return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type;

    } catch (ex) {
        alert(ex);
    }
}
log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
        + ' - ' + "key"
        + ' - ' + "keyCode"
        + ' - ' + "charCode");

if (document.getElementsByTagName("input")[0].addEventListener)
    document.getElementsByTagName("input")[0].addEventListener('textInput', function(e) {log(eventInfo(e));}, false);

document.getElementsByTagName("input")[0].focus();

if (window.testRunner) {
    testRunner.dumpAsText();
    log("Space:");
    eventSender.keyDown(" ", []);
    log("Enter:");
    eventSender.keyDown("Enter", []);
    log("A:");
    eventSender.keyDown("A", []);
}
</script>