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

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

Issue 2096363002: MacViews: Fix text input for password textfields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@password_text_fix
Patch Set: Rebase. Created 4 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/cocoa/bridged_content_view.mm ('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 5db243c102d15b554ea7c75f3dab2c7736bc75d7..390043b7166e4aa880ec70824379618000bf603d 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -955,6 +955,31 @@ TEST_F(TextfieldTest, PasswordTest) {
EXPECT_STR_EQ("foofoofoo", textfield_->text());
}
+// Check that text insertion works appropriately for password and read-only
+// textfields.
+TEST_F(TextfieldTest, TextInputType_InsertionTest) {
+ InitTextfield();
+ textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
+ EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, textfield_->GetTextInputType());
+
+ SendKeyEvent(ui::VKEY_A);
+ SendKeyEvent(kHebrewLetterSamekh);
+ SendKeyEvent(ui::VKEY_B);
+
+ EXPECT_EQ(WideToUTF16(L"a\x05E1"
+ L"b"),
+ textfield_->text());
+
+ textfield_->SetReadOnly(true);
+ EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, textfield_->GetTextInputType());
+ SendKeyEvent(ui::VKEY_C);
+
+ // No text should be inserted for read only textfields.
+ EXPECT_EQ(WideToUTF16(L"a\x05E1"
+ L"b"),
+ textfield_->text());
+}
+
TEST_F(TextfieldTest, TextInputType) {
InitTextfield();
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698