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

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: More checks 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
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5d48b0e08c249a5b6bdd79f84e690c32a9b1ba5b 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -1334,11 +1334,23 @@ 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());
+ input_method_->Clear();
textfield_->SetReadOnly(false);
+ EXPECT_TRUE(input_method_->text_input_type_changed());
+ EXPECT_EQ(text_input_client, textfield_->GetTextInputClient());
+ 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());
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698