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

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

Issue 902783006: Mask the value of passwords in accessible value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 5 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
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/textfield_unittest.cc
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc
index 61ffc3c56b20182c41c61989f86b2524b3cbced9..9c1a9cf835735f48b4012dd81e226e4ae9d56d8c 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -12,6 +12,7 @@
#include "base/pickle.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
+#include "ui/accessibility/ax_view_state.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/dragdrop/drag_drop_types.h"
@@ -2189,4 +2190,22 @@ TEST_F(TextfieldTouchSelectionTest, TapOnSelection) {
EXPECT_EQ(tap_range, range);
}
+TEST_F(TextfieldTest, AccessiblePasswordTest) {
+ InitTextfield();
+ textfield_->SetText(ASCIIToUTF16("password"));
+
+ ui::AXViewState state_regular;
+ textfield_->GetAccessibleState(&state_regular);
+ EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_regular.role);
+ EXPECT_EQ(ASCIIToUTF16("password"), state_regular.value);
+ EXPECT_FALSE(state_regular.HasStateFlag(ui::AX_STATE_PROTECTED));
+
+ textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
+ ui::AXViewState state_protected;
+ textfield_->GetAccessibleState(&state_protected);
+ EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
+ EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
+ EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
+}
+
} // namespace views
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698