OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/pickle.h" | 12 #include "base/pickle.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "ui/accessibility/ax_view_state.h" |
15 #include "ui/base/clipboard/clipboard.h" | 16 #include "ui/base/clipboard/clipboard.h" |
16 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 17 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
17 #include "ui/base/dragdrop/drag_drop_types.h" | 18 #include "ui/base/dragdrop/drag_drop_types.h" |
18 #include "ui/base/ime/text_input_client.h" | 19 #include "ui/base/ime/text_input_client.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/base/ui_base_switches.h" | 21 #include "ui/base/ui_base_switches.h" |
21 #include "ui/base/ui_base_switches_util.h" | 22 #include "ui/base/ui_base_switches_util.h" |
22 #include "ui/events/event.h" | 23 #include "ui/events/event.h" |
23 #include "ui/events/keycodes/keyboard_codes.h" | 24 #include "ui/events/keycodes/keyboard_codes.h" |
24 #include "ui/events/test/event_generator.h" | 25 #include "ui/events/test/event_generator.h" |
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 EXPECT_EQ(sel_range, range); | 2183 EXPECT_EQ(sel_range, range); |
2183 | 2184 |
2184 // Tap again on selection and check if touch selection handles are still | 2185 // Tap again on selection and check if touch selection handles are still |
2185 // present and selection is changed to a cursor at tap location. | 2186 // present and selection is changed to a cursor at tap location. |
2186 Tap(tap_point); | 2187 Tap(tap_point); |
2187 textfield_->GetSelectionRange(&range); | 2188 textfield_->GetSelectionRange(&range); |
2188 EXPECT_TRUE(test_api_->touch_selection_controller()); | 2189 EXPECT_TRUE(test_api_->touch_selection_controller()); |
2189 EXPECT_EQ(tap_range, range); | 2190 EXPECT_EQ(tap_range, range); |
2190 } | 2191 } |
2191 | 2192 |
| 2193 TEST_F(TextfieldTest, AccessiblePasswordTest) { |
| 2194 InitTextfield(); |
| 2195 textfield_->SetText(ASCIIToUTF16("password")); |
| 2196 |
| 2197 ui::AXViewState state_regular; |
| 2198 textfield_->GetAccessibleState(&state_regular); |
| 2199 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_regular.role); |
| 2200 EXPECT_EQ(ASCIIToUTF16("password"), state_regular.value); |
| 2201 EXPECT_FALSE(state_regular.HasStateFlag(ui::AX_STATE_PROTECTED)); |
| 2202 |
| 2203 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 2204 ui::AXViewState state_protected; |
| 2205 textfield_->GetAccessibleState(&state_protected); |
| 2206 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
| 2207 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
| 2208 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
| 2209 } |
| 2210 |
2192 } // namespace views | 2211 } // namespace views |
OLD | NEW |