Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: ui/views/controls/combobox/combobox_unittest.cc

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698