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

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: rebase, const syntax, password->obscured, dead methods, DCHECK, Ctrl+[CX] tests, fix other tests 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..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()));

Powered by Google App Engine
This is Rietveld 408576698