| 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 7c26892d4c69602992fa9cac1f8a0edd8ec1ba22..793f6331e69f3a0fc87c020fb8bc5cb05f80afa7 100644
|
| --- a/ui/views/controls/textfield/textfield_unittest.cc
|
| +++ b/ui/views/controls/textfield/textfield_unittest.cc
|
| @@ -951,6 +951,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('a');
|
| + SendKeyEvent(0x05E1);
|
| + SendKeyEvent('b');
|
| +
|
| + EXPECT_EQ(WideToUTF16(L"a\x05E1"
|
| + L"b"),
|
| + textfield_->text());
|
| +
|
| + textfield_->SetReadOnly(true);
|
| + EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, textfield_->GetTextInputType());
|
| + SendKeyEvent('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();
|
|
|
|
|