summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 19:52:32 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 19:52:32 +0000
commit6f19e834a92fb075aa2b233b11f7e33b9ddfc4f5 (patch)
tree3bbf32cfaf45ce0d1d6ce88900a3d3f32baedfcd /ui
parent2d9f1953528051c9434e3abc2ba681c11db1dd8e (diff)
downloadchromium_src-6f19e834a92fb075aa2b233b11f7e33b9ddfc4f5.zip
chromium_src-6f19e834a92fb075aa2b233b11f7e33b9ddfc4f5.tar.gz
chromium_src-6f19e834a92fb075aa2b233b11f7e33b9ddfc4f5.tar.bz2
Fix FocusManagerDtorTest for NativeTexfieldViews; etc.
Avoid Widget's lazy InputMethod construction in View::GetInputMethod(). ( fixes FocusManagerDtorTest.FocusManagerDestructedLast for Views Textfield ) Remove TestTextfield subclass (call Textfield::GetTestingHandle directly). Enable/Extend FocusManagerTest.FocusTextfield (was FocusNativeControls). Remove the GetInputMethod DCHECK in NativeTextfieldViews::HandleKeyEvent. ( unnecessary / not used there; tests pass without it, etc. ) BUG=131660 TEST=No [IME] input regressions with or without --enable-views-textfields R=suzhe@chromium.org,sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/12600029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189069 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/controls/textfield/native_textfield_views.cc3
-rw-r--r--ui/views/focus/focus_manager_unittest.cc24
-rw-r--r--ui/views/view.cc3
3 files changed, 9 insertions, 21 deletions
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index ed6c071..66b1dfa 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -1182,9 +1182,6 @@ bool NativeTextfieldViews::HandleKeyEvent(const ui::KeyEvent& key_event) {
break;
}
- // We must have input method in order to support text input.
- DCHECK(textfield_->GetInputMethod());
-
UpdateAfterChange(text_changed, cursor_changed);
OnAfterUserAction();
return (text_changed || cursor_changed);
diff --git a/ui/views/focus/focus_manager_unittest.cc b/ui/views/focus/focus_manager_unittest.cc
index 9c3e689..a00a0b4 100644
--- a/ui/views/focus/focus_manager_unittest.cc
+++ b/ui/views/focus/focus_manager_unittest.cc
@@ -163,25 +163,15 @@ TEST_F(FocusManagerTest, WidgetFocusChangeListener) {
widget_listener.focus_changes()[1]);
}
-#if !defined(USE_AURA)
-class TestTextfield : public Textfield {
- public:
- TestTextfield() {}
- virtual gfx::NativeView TestGetNativeControlView() {
- return native_wrapper_->GetTestingHandle();
- }
-};
-
-// Tests that NativeControls do set the focused View appropriately on the
-// FocusManager.
-TEST_F(FocusManagerTest, DISABLED_FocusNativeControls) {
- TestTextfield* textfield = new TestTextfield();
+TEST_F(FocusManagerTest, FocusTextfield) {
+ Textfield* textfield = new Textfield();
GetContentsView()->AddChildView(textfield);
- // Simulate the native view getting the native focus (such as by user click).
- FocusNativeView(textfield->TestGetNativeControlView());
+ if (!Textfield::IsViewsTextfieldEnabled())
+ FocusNativeView(textfield->GetTestingHandle());
+ else
+ textfield->RequestFocus();
EXPECT_EQ(textfield, GetFocusManager()->GetFocusedView());
}
-#endif
// Counts accelerator calls.
class TestAcceleratorTarget : public ui::AcceleratorTarget {
@@ -587,7 +577,7 @@ class FocusManagerDtorTest : public FocusManagerTest {
#if !defined(USE_AURA)
TEST_F(FocusManagerDtorTest, FocusManagerDestructedLast) {
// Setup views hierarchy.
- GetContentsView()->AddChildView(new TestTextfield());
+ GetContentsView()->AddChildView(new Textfield());
GetContentsView()->AddChildView(new NativeButtonDtorTracked(
ASCIIToUTF16("button"), &dtor_tracker_));
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 85f43a2..e014e0a 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -987,7 +987,8 @@ ui::TextInputClient* View::GetTextInputClient() {
InputMethod* View::GetInputMethod() {
Widget* widget = GetWidget();
- return widget ? widget->GetInputMethod() : NULL;
+ // Call GetInputMethodDirect() to avoid initialization in GetInputMethod().
+ return widget ? widget->GetInputMethodDirect() : NULL;
}
bool View::CanAcceptEvent(const ui::Event& event) {