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

Unified Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 919543003: Make Textfield::GetTextInputClient() return non-null, even if readonly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150211-MacViews-TextfileTest-B-split-input-method
Patch Set: Created 5 years, 10 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
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 1c47e635dede5f1422a8655e7149edf52311de9e..94e76892b295b063c846bd20221fa624c0574a7a 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -1334,11 +1334,20 @@ TEST_F(TextfieldTest, TextInputClientTest) {
EXPECT_EQ(0, on_after_user_action_);
input_method_->Clear();
+
+ // Changing the Textfield to readonly shouldn't change the input client, since
+ // it's still required for selections and clipboard copy.
+ ui::TextInputClient* text_input_client = textfield_->GetTextInputClient();
+ EXPECT_TRUE(text_input_client);
+ EXPECT_NE(ui::TEXT_INPUT_TYPE_NONE, text_input_client->GetTextInputType());
textfield_->SetReadOnly(true);
EXPECT_TRUE(input_method_->text_input_type_changed());
- EXPECT_FALSE(textfield_->GetTextInputClient());
+ EXPECT_EQ(text_input_client, textfield_->GetTextInputClient());
+ EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, text_input_client->GetTextInputType());
textfield_->SetReadOnly(false);
msw 2015/02/11 16:45:00 nit: add EXPECT_TRUE(input_method_->text_input_typ
tapted 2015/02/11 23:29:08 Done.
+ EXPECT_NE(ui::TEXT_INPUT_TYPE_NONE, text_input_client->GetTextInputType());
+
input_method_->Clear();
textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
EXPECT_TRUE(input_method_->text_input_type_changed());
« ui/views/controls/textfield/textfield.cc ('K') | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698