blob: 8a49686476fa7c57b865c449173183a0e6d4c2e1 [file] [log] [blame]
<html>
<head>
<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
<script>
function load()
{
window.internals.setFocused(false);
runTest();
}
function dump()
{
log("================");
log("value of foo:" + document.getElementById("foo").value);
log("value of bar:" + document.getElementById("bar").value);
log("value of baz:" + document.getElementById("baz").value);
window.internals.setFocused(true);
}
function test()
{
type("foo");
typeTab();
type("bar");
typeTab();
InspectorTest.evaluateInPage("dump()", InspectorTest.completeTest.bind(InspectorTest));
function type(text)
{
for (var i = 0; i < text.length; ++i) {
var dec = text.charCodeAt(i);
var hex = "U+00" + Number(dec).toString(16);
InspectorTest.sendCommand("Input.dispatchKeyEvent", {
"type": "rawKeyDown",
"windowsVirtualKeyCode": dec,
"keyIdentifier": hex
});
InspectorTest.sendCommand("Input.dispatchKeyEvent", {
"type": "char",
"text": text[i],
"unmodifiedText": text[i]
});
InspectorTest.sendCommand("Input.dispatchKeyEvent", {
"type": "keyUp",
"windowsVirtualKeyCode": dec,
"keyIdentifier": hex
});
}
}
function typeTab()
{
InspectorTest.sendCommand("Input.dispatchKeyEvent", {
"type": "rawKeyDown",
"windowsVirtualKeyCode": 9,
"keyIdentifier": "U+0009"
});
InspectorTest.sendCommand("Input.dispatchKeyEvent", {
"type": "char"
});
InspectorTest.sendCommand("Input.dispatchKeyEvent", {
"type": "keyUp",
"windowsVirtualKeyCode": 9,
"keyIdentifier": "U+0009"
});
}
}
</script>
</head>
<body onload="load()">
<div id="inputs">
<input onfocus="log('focus foo')" onblur="log('blur foo')" id="foo" autofocus>
<input onfocus="log('focus bar')" onblur="log('blur bar')" id="bar">
<input onfocus="log('focus baz')" onblur="log('blur baz')" id="baz">
</div>
</body>
</html>