Chromium Code Reviews| Index: ui/views/controls/textfield/native_textfield_views_unittest.cc |
| diff --git a/ui/views/controls/textfield/native_textfield_views_unittest.cc b/ui/views/controls/textfield/native_textfield_views_unittest.cc |
| index 21213d213cf5a7633fb8ec37c93d49fe15783575..dcbfe926be13ca72e1d711c45c007de184c6858c 100644 |
| --- a/ui/views/controls/textfield/native_textfield_views_unittest.cc |
| +++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc |
| @@ -509,6 +509,18 @@ TEST_F(NativeTextfieldViewsTest, PasswordTest) { |
| // the actual text instead of "*". |
| EXPECT_STR_EQ("my password", textfield_->text()); |
| EXPECT_TRUE(last_contents_.empty()); |
| + |
| + // Cut and copy should be disabled in the context menu. |
| + model_->SelectAll(); |
| + EXPECT_FALSE(IsCommandIdEnabled(IDS_APP_CUT)); |
| + EXPECT_FALSE(IsCommandIdEnabled(IDS_APP_COPY)); |
| + |
| + // Cut and copy keyboard shortcuts should do nothing. |
| + SetClipboardText("foo"); |
| + SendKeyEvent(ui::VKEY_C, false, true); |
| + EXPECT_STR_EQ("foo", string16(GetClipboardText())); |
| + SendKeyEvent(ui::VKEY_X, false, true); |
| + EXPECT_STR_EQ("foo", string16(GetClipboardText())); |
|
oshima
2011/12/06 23:57:18
check if textfield still has the same text.
benrg
2011/12/08 21:40:55
Done.
|
| } |
| TEST_F(NativeTextfieldViewsTest, InputTypeSetsPassword) { |
| @@ -822,6 +834,11 @@ TEST_F(NativeTextfieldViewsTest, MAYBE_DragAndDrop_InitiateDrag) { |
| EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, |
| textfield_view_->GetDragOperationsForView(NULL, kStringPoint)); |
| textfield_->SelectRange(kStringRange); |
| + // Ensure that password textfields do not support drag operations. |
| + textfield_->SetIsPassword(true); |
| + EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, |
| + textfield_view_->GetDragOperationsForView(NULL, kStringPoint)); |
| + textfield_->SetIsPassword(false); |
| // Ensure that textfields only initiate drag operations inside the selection. |
| EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, |
| textfield_view_->GetDragOperationsForView(NULL, gfx::Point())); |