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

Side by Side Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/controls/tree/tree_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/format_macros.h" 15 #include "base/format_macros.h"
16 #include "base/i18n/rtl.h" 16 #include "base/i18n/rtl.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/pickle.h" 18 #include "base/pickle.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "ui/accessibility/ax_view_state.h" 23 #include "ui/accessibility/ax_node_data.h"
24 #include "ui/base/clipboard/clipboard.h" 24 #include "ui/base/clipboard/clipboard.h"
25 #include "ui/base/clipboard/scoped_clipboard_writer.h" 25 #include "ui/base/clipboard/scoped_clipboard_writer.h"
26 #include "ui/base/dragdrop/drag_drop_types.h" 26 #include "ui/base/dragdrop/drag_drop_types.h"
27 #include "ui/base/ime/input_method_base.h" 27 #include "ui/base/ime/input_method_base.h"
28 #include "ui/base/ime/input_method_delegate.h" 28 #include "ui/base/ime/input_method_delegate.h"
29 #include "ui/base/ime/input_method_factory.h" 29 #include "ui/base/ime/input_method_factory.h"
30 #include "ui/base/ime/text_edit_commands.h" 30 #include "ui/base/ime/text_edit_commands.h"
31 #include "ui/base/ime/text_input_client.h" 31 #include "ui/base/ime/text_input_client.h"
32 #include "ui/base/ui_base_switches.h" 32 #include "ui/base/ui_base_switches.h"
33 #include "ui/base/ui_base_switches_util.h" 33 #include "ui/base/ui_base_switches_util.h"
(...skipping 2956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 Tap(tap_point); 2990 Tap(tap_point);
2991 textfield_->GetSelectionRange(&range); 2991 textfield_->GetSelectionRange(&range);
2992 EXPECT_TRUE(test_api_->touch_selection_controller()); 2992 EXPECT_TRUE(test_api_->touch_selection_controller());
2993 EXPECT_EQ(tap_range, range); 2993 EXPECT_EQ(tap_range, range);
2994 } 2994 }
2995 2995
2996 TEST_F(TextfieldTest, AccessiblePasswordTest) { 2996 TEST_F(TextfieldTest, AccessiblePasswordTest) {
2997 InitTextfield(); 2997 InitTextfield();
2998 textfield_->SetText(ASCIIToUTF16("password")); 2998 textfield_->SetText(ASCIIToUTF16("password"));
2999 2999
3000 ui::AXViewState state_regular; 3000 ui::AXNodeData node_data_regular;
3001 textfield_->GetAccessibleState(&state_regular); 3001 node_data_regular.state = 0;
3002 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_regular.role); 3002 textfield_->GetAccessibleNodeData(&node_data_regular);
3003 EXPECT_EQ(ASCIIToUTF16("password"), state_regular.value); 3003 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_regular.role);
3004 EXPECT_FALSE(state_regular.HasStateFlag(ui::AX_STATE_PROTECTED)); 3004 EXPECT_EQ(ASCIIToUTF16("password"),
3005 node_data_regular.GetString16Attribute(ui::AX_ATTR_VALUE));
3006 EXPECT_FALSE(node_data_regular.HasStateFlag(ui::AX_STATE_PROTECTED));
3005 3007
3006 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 3008 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
3007 ui::AXViewState state_protected; 3009 ui::AXNodeData node_data_protected;
3008 textfield_->GetAccessibleState(&state_protected); 3010 node_data_protected.state = 0;
3009 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 3011 textfield_->GetAccessibleNodeData(&node_data_protected);
3010 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 3012 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role);
3011 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 3013 EXPECT_EQ(ASCIIToUTF16("********"),
3014 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE));
3015 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
3012 } 3016 }
3013 3017
3014 } // namespace views 3018 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/controls/tree/tree_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698