<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<meta name="viewport" content="width=device-width">
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<script>
doneCount = 0;
jsTestIsAsync = true;

async function runTest() {
    if (!window.testRunner) {
        description(`This test requires WebKitTestRunner.`);
        return;
    }

    testRunner.installTextFieldDidBeginEditingCallback(() => debug(`TextFieldDidBeginEditing ('${field.value}')`));
    testRunner.installTextDidChangeInTextFieldCallback(() => debug(`TextDidChangeInTextField ('${field.value}')`));
    testRunner.installTextFieldDidEndEditingCallback(() => debug(`TextFieldDidEndEditing ('${field.value}')`));

    await UIHelper.activateAndWaitForInputSessionAt(75, 75);
    UIHelper.waitForKeyboardToHide().then(checkDone);
    UIHelper.enterText("Hello world");
}

function checkDone() {
    doneCount++;
    if (doneCount == 3)
        finishJSTest();
}
</script>
</head>

<body onload="runTest()">
<input id="field" style="width: 320px; height: 568px;" onchange="checkDone()" onblur="checkDone()"></input>
</body>
</html>
