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) { |