Chromium Code Reviews| Index: ui/views/controls/textfield/textfield_unittest.cc |
| diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc |
| index 4de82b0a20be2f97ede82427d5dcb64d62d9a632..7c26892d4c69602992fa9cac1f8a0edd8ec1ba22 100644 |
| --- a/ui/views/controls/textfield/textfield_unittest.cc |
| +++ b/ui/views/controls/textfield/textfield_unittest.cc |
| @@ -147,6 +147,12 @@ bool MockInputMethod::OnUntranslatedIMEMessage(const base::NativeEvent& event, |
| } |
| void MockInputMethod::DispatchKeyEvent(ui::KeyEvent* key) { |
| +// On Mac, emulate InputMethodMac behavior. |
| +#if defined(OS_MACOSX) |
| + ignore_result(DispatchKeyEventPostIME(key)); |
| + return; |
| +#endif |
| + |
| // Checks whether the key event is from EventGenerator on Windows which will |
| // generate key event for WM_CHAR. |
| // The MockInputMethod will insert char on WM_KEYDOWN so ignore WM_CHAR here. |
| @@ -510,9 +516,15 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController { |
| SendKeyEvent(code); |
| } else { |
| // For unicode characters, assume they come from IME rather than the |
| - // keyboard. So they are dispatched directly to the input method. |
| + // keyboard. So they are dispatched directly to the input method. But on |
| + // Mac, key events don't pass through InputMethod. Hence they are |
| + // dispatched regularly. |
| ui::KeyEvent event(ch, ui::VKEY_UNKNOWN, ui::EF_NONE); |
| +#if defined(OS_MACOSX) |
| + event_generator_->Dispatch(&event); |
|
tapted
2016/06/29 07:21:39
can you explain (in the CL description perhaps) wh
karandeepb
2016/06/29 07:54:07
Done.
|
| +#else |
| input_method_->DispatchKeyEvent(&event); |
|
karandeepb
2016/06/29 01:42:41
Not sure if the event needs to be dispatched direc
tapted
2016/06/29 07:21:39
This looks ok.. Event dispatch can be a bit crazy,
|
| +#endif |
| } |
| } |