<!DOCTYPE html>
<p>This tests whether an input field scrolls to the end of the new composition when setComposition is called.</p>
<input size="10"/>
<pre id="log">
</pre>
<script>
function log(s) {
    document.getElementById('log').appendChild(document.createTextNode(s + "\n"));
}

if (window.testRunner)
    window.testRunner.dumpAsText();

var input = document.querySelector('input');
input.focus();
textInputController.setComposition('longsinglewordstringcomposition');
var maxScrollLeft = input.scrollWidth - input.clientWidth;
if (maxScrollLeft - input.scrollLeft < 5)
    log("SUCCESS: input has scrolled to the end of the composition");
else
    log("FAILED: input has not scrolled to the end of the composition. scrollLeft=" + input.scrollLeft);
</script>
