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

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

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Delete AXNodeData::Init() and clear bitfields in AXNodeData() instead. Created 3 years, 7 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 unified diff | Download patch
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>
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 textfield_->GetSelectionRange(&range); 3094 textfield_->GetSelectionRange(&range);
3095 EXPECT_TRUE(test_api_->touch_selection_controller()); 3095 EXPECT_TRUE(test_api_->touch_selection_controller());
3096 EXPECT_EQ(tap_range, range); 3096 EXPECT_EQ(tap_range, range);
3097 } 3097 }
3098 3098
3099 TEST_F(TextfieldTest, AccessiblePasswordTest) { 3099 TEST_F(TextfieldTest, AccessiblePasswordTest) {
3100 InitTextfield(); 3100 InitTextfield();
3101 textfield_->SetText(ASCIIToUTF16("password")); 3101 textfield_->SetText(ASCIIToUTF16("password"));
3102 3102
3103 ui::AXNodeData node_data_regular; 3103 ui::AXNodeData node_data_regular;
3104 node_data_regular.state = 0;
3105 textfield_->GetAccessibleNodeData(&node_data_regular); 3104 textfield_->GetAccessibleNodeData(&node_data_regular);
3106 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_regular.role); 3105 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_regular.role);
3107 EXPECT_EQ(ASCIIToUTF16("password"), 3106 EXPECT_EQ(ASCIIToUTF16("password"),
3108 node_data_regular.GetString16Attribute(ui::AX_ATTR_VALUE)); 3107 node_data_regular.GetString16Attribute(ui::AX_ATTR_VALUE));
3109 EXPECT_FALSE(node_data_regular.HasStateFlag(ui::AX_STATE_PROTECTED)); 3108 EXPECT_FALSE(node_data_regular.HasState(ui::AX_STATE_PROTECTED));
3110 3109
3111 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 3110 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
3112 ui::AXNodeData node_data_protected; 3111 ui::AXNodeData node_data_protected;
3113 node_data_protected.state = 0;
3114 textfield_->GetAccessibleNodeData(&node_data_protected); 3112 textfield_->GetAccessibleNodeData(&node_data_protected);
3115 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); 3113 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role);
3116 EXPECT_EQ(ASCIIToUTF16("********"), 3114 EXPECT_EQ(ASCIIToUTF16("********"),
3117 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); 3115 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE));
3118 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 3116 EXPECT_TRUE(node_data_protected.HasState(ui::AX_STATE_PROTECTED));
3119 } 3117 }
3120 3118
3121 // Verify that cursor visibility is controlled by SetCursorEnabled. 3119 // Verify that cursor visibility is controlled by SetCursorEnabled.
3122 TEST_F(TextfieldTest, CursorVisibility) { 3120 TEST_F(TextfieldTest, CursorVisibility) {
3123 InitTextfield(); 3121 InitTextfield();
3124 3122
3125 textfield_->SetCursorEnabled(false); 3123 textfield_->SetCursorEnabled(false);
3126 EXPECT_FALSE(test_api_->IsCursorVisible()); 3124 EXPECT_FALSE(test_api_->IsCursorVisible());
3127 3125
3128 textfield_->SetCursorEnabled(true); 3126 textfield_->SetCursorEnabled(true);
3129 EXPECT_TRUE(test_api_->IsCursorVisible()); 3127 EXPECT_TRUE(test_api_->IsCursorVisible());
3130 } 3128 }
3131 3129
3132 } // namespace views 3130 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698