[omnibox] Break out SetCaretPos() method and enhance browser test
Instead of calling SetWindowTextAndCaretPos() twice, add a SetCaretPos()
method so that we can call it instead.
Also, enhance the portable browser tests to make sure the caret
position is restored, but also capped at the text length.
BUG=681740
Review-Url: https://codereview.chromium.org/2891653003
Cr-Commit-Position: refs/heads/master@{#475045}