| Index: ui/wm/core/input_method_event_filter_unittest.cc
|
| diff --git a/ui/wm/core/input_method_event_filter_unittest.cc b/ui/wm/core/input_method_event_filter_unittest.cc
|
| index c5daa677ff726f319b6c74f616e7c475fb300f10..6a349c6f73873fd6692e8f1b058b02be9df0fec4 100644
|
| --- a/ui/wm/core/input_method_event_filter_unittest.cc
|
| +++ b/ui/wm/core/input_method_event_filter_unittest.cc
|
| @@ -10,6 +10,9 @@
|
| #include "ui/aura/test/event_generator.h"
|
| #include "ui/aura/test/test_windows.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| +#include "ui/base/ime/input_method.h"
|
| +#include "ui/events/event.h"
|
| +#include "ui/events/event_processor.h"
|
| #include "ui/events/test/test_event_handler.h"
|
| #include "ui/wm/core/compound_event_filter.h"
|
| #include "ui/wm/core/default_activation_client.h"
|
| @@ -56,6 +59,8 @@ TEST_F(InputMethodEventFilterTest, TestInputMethodKeyEventPropagation) {
|
| InputMethodEventFilter input_method_event_filter(
|
| host()->GetAcceleratedWidget());
|
| root_filter.AddHandler(&input_method_event_filter);
|
| + input_method_event_filter.UpdateTargetDispatcher(
|
| + root_window()->GetHost()->event_processor());
|
|
|
| // Add TestEventFilter to the RootWindow.
|
| ui::test::TestEventHandler test_filter;
|
| @@ -91,4 +96,41 @@ TEST_F(InputMethodEventFilterTest, TestInputMethodKeyEventPropagation) {
|
| root_window()->RemovePreTargetHandler(&root_filter);
|
| }
|
|
|
| +// Tests event dispathching for IME composing.
|
| +TEST_F(InputMethodEventFilterTest, TestEventDispatching) {
|
| + CompoundEventFilter root_filter;
|
| + root_window()->AddPreTargetHandler(&root_filter);
|
| +
|
| + InputMethodEventFilter input_method_event_filter(
|
| + host()->GetAcceleratedWidget());
|
| + root_filter.AddHandler(&input_method_event_filter);
|
| +
|
| + // Add TestEventFilter to the RootWindow.
|
| + ui::test::TestEventHandler test_filter;
|
| + root_filter.AddHandler(&test_filter);
|
| +
|
| + ui::KeyEvent evt(ui::ET_KEY_PRESSED,
|
| + ui::VKEY_PROCESSKEY,
|
| + ui::EF_IME_FABRICATED_KEY,
|
| + false);
|
| + // Without onKeyEvent() being called, and no event processor, calls
|
| + // DispatchKeyEventPostIME().
|
| + input_method_event_filter.input_method()->DispatchKeyEvent(evt);
|
| + // Verifies no key event happened because InputMethodEventFilter::
|
| + // DispatchKeyEventPostIME() returns false.
|
| + EXPECT_EQ(0, test_filter.num_key_events());
|
| +
|
| + // Without onKeyEvent() being called, update event processor, calls
|
| + // DispatchKeyEventPostIME().
|
| + input_method_event_filter.UpdateTargetDispatcher(
|
| + root_window()->GetHost()->event_processor());
|
| + input_method_event_filter.input_method()->DispatchKeyEvent(evt);
|
| + // Verifies 1 key event happened because InputMethodEventFilter::
|
| + // DispatchKeyEventPostIME() returns true.
|
| + EXPECT_EQ(1, test_filter.num_key_events());
|
| +
|
| + root_filter.RemoveHandler(&input_method_event_filter);
|
| + root_window()->RemovePreTargetHandler(&root_filter);
|
| +}
|
| +
|
| } // namespace wm
|
|
|