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

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

Issue 9467017: Password support for NativeTextfieldViews, in the model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months 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 069b544a23bb07393dff7f8b15bb92189918f190..1bb0a0d22e259578fbf536a67c91632161e18c80 100644
--- a/ui/views/controls/textfield/native_textfield_views_unittest.cc
+++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc
@@ -14,6 +14,7 @@
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
+#include "grit/ui_strings.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
@@ -495,6 +496,20 @@ 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 and menu commands should do nothing.
+ SetClipboardText("foo");
+ SendKeyEvent(ui::VKEY_C, false, true);
+ SendKeyEvent(ui::VKEY_X, false, true);
+ ExecuteCommand(IDS_APP_COPY);
+ ExecuteCommand(IDS_APP_CUT);
+ EXPECT_STR_EQ("foo", string16(GetClipboardText()));
+ EXPECT_STR_EQ("my password", textfield_->text());
}
TEST_F(NativeTextfieldViewsTest, InputTypeSetsObscured) {
« no previous file with comments | « ui/views/controls/textfield/native_textfield_views.cc ('k') | ui/views/controls/textfield/textfield_views_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698