| Index: ui/views/controls/combobox/combobox_unittest.cc
|
| diff --git a/ui/views/controls/combobox/combobox_unittest.cc b/ui/views/controls/combobox/combobox_unittest.cc
|
| index c81160362cdfbf239265b8451cc09ff75eee1faf..a3cba309a1be69d127474ef093c97cee5945a35c 100644
|
| --- a/ui/views/controls/combobox/combobox_unittest.cc
|
| +++ b/ui/views/controls/combobox/combobox_unittest.cc
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "ui/base/ime/input_method.h"
|
| #include "ui/base/ime/text_input_client.h"
|
| #include "ui/base/models/combobox_model.h"
|
| #include "ui/events/event.h"
|
| @@ -17,7 +18,6 @@
|
| #include "ui/views/controls/combobox/combobox_listener.h"
|
| #include "ui/views/controls/menu/menu_runner.h"
|
| #include "ui/views/controls/menu/menu_runner_handler.h"
|
| -#include "ui/views/ime/mock_input_method.h"
|
| #include "ui/views/test/menu_runner_test_api.h"
|
| #include "ui/views/test/views_test_base.h"
|
| #include "ui/views/widget/widget.h"
|
| @@ -225,11 +225,6 @@ class ComboboxTest : public ViewsTestBase {
|
| widget_->SetContentsView(container);
|
| container->AddChildView(combobox_);
|
|
|
| - widget_->ReplaceInputMethod(new MockInputMethod);
|
| -
|
| - // Assumes the Widget is always focused.
|
| - widget_->GetInputMethod()->OnFocus();
|
| -
|
| combobox_->RequestFocus();
|
| combobox_->SizeToPreferredSize();
|
| }
|
| @@ -241,7 +236,10 @@ class ComboboxTest : public ViewsTestBase {
|
|
|
| void SendKeyEventWithType(ui::KeyboardCode key_code, ui::EventType type) {
|
| ui::KeyEvent event(type, key_code, ui::EF_NONE);
|
| - widget_->GetInputMethod()->DispatchKeyEvent(event);
|
| + FocusManager* focus_manager = widget_->GetFocusManager();
|
| + widget_->OnKeyEvent(&event);
|
| + if (!event.handled() && focus_manager)
|
| + focus_manager->OnKeyEvent(event);
|
| }
|
|
|
| View* GetFocusedView() {
|
| @@ -669,24 +667,27 @@ TEST_F(ComboboxTest, TypingPrefixNotifiesListener) {
|
|
|
| TestComboboxListener listener;
|
| combobox_->set_listener(&listener);
|
| + ui::TextInputClient* input_client =
|
| + widget_->GetInputMethod()->GetTextInputClient();
|
|
|
| // Type the first character of the second menu item ("JELLY").
|
| - combobox_->GetTextInputClient()->InsertChar('J', ui::EF_NONE);
|
| + input_client->InsertChar('J', ui::EF_NONE);
|
| EXPECT_EQ(1, listener.actions_performed());
|
| EXPECT_EQ(1, listener.perform_action_index());
|
|
|
| // Type the second character of "JELLY", item shouldn't change and
|
| // OnPerformAction() shouldn't be re-called.
|
| - combobox_->GetTextInputClient()->InsertChar('E', ui::EF_NONE);
|
| + input_client->InsertChar('E', ui::EF_NONE);
|
| EXPECT_EQ(1, listener.actions_performed());
|
| EXPECT_EQ(1, listener.perform_action_index());
|
|
|
| // Clears the typed text.
|
| combobox_->OnBlur();
|
| + combobox_->RequestFocus();
|
|
|
| // Type the first character of "PEANUT BUTTER", which should change the
|
| // selected index and perform an action.
|
| - combobox_->GetTextInputClient()->InsertChar('P', ui::EF_NONE);
|
| + input_client->InsertChar('P', ui::EF_NONE);
|
| EXPECT_EQ(2, listener.actions_performed());
|
| EXPECT_EQ(2, listener.perform_action_index());
|
| }
|
|
|