• Darren Shen's avatar
    ime: Make AutocorrectManager more testable and add unit tests. · 7056ad03
    Darren Shen authored
    AutocorrectManager was hard to test because it required a full
    InputMethodEngine as a dependency. However, it really only needs two
    dependencies: an input context handler to manipulate text, and a
    suggestion handler to manipulate the autocorrect range.
    
    Pass in the suggestion handler via the ctor, and grab the input context
    handler via IMEBridge*.
    
    Add a few unit tests with mock handlers. In a future patch, we will
    add a proper fake input context handler so that it's easy to test
    UndoAutocorrect.
    
    * Note that there's an open bug to remove IMEBridge as it is global
    state. See crbug.com/1149751.
    
    Bug: b/172969200
    Change-Id: Ic9deefb873ee94895846bd91efe608ef10418eb8
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2543537
    Commit-Queue: Darren Shen <shend@chromium.org>
    Reviewed-by: default avatarMy Nguyen <myy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#828933}
    7056ad03
assistive_window_properties.cc 1003 Bytes