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

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

Issue 8747001: Reintroduce password support to NativeTextfieldViews (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete more dead code, address recent comments Created 9 years 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/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..1e431dea7db333ad0b96230492ce0d8955b5609b 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);
+ SendKeyEvent(ui::VKEY_X, false, true);
+ EXPECT_STR_EQ("foo", string16(GetClipboardText()));
+ EXPECT_STR_EQ("my password", textfield_->text());
}
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()));

Powered by Google App Engine
This is Rietveld 408576698