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

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: make password in RenderText an instance property and disable cut, copy, D&D, and word skipping 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..61ec36e3a7bdb8524f3b9b2b23eea8e16fc70e19 100644
--- a/ui/views/controls/textfield/native_textfield_views_unittest.cc
+++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc
@@ -509,6 +509,11 @@ 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));
oshima 2011/12/02 23:15:54 can you also add ctrl-c/ctrl-x?
benrg 2011/12/06 17:21:30 Done.
}
TEST_F(NativeTextfieldViewsTest, InputTypeSetsPassword) {
@@ -822,6 +827,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