| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3135 textfield_->GetAccessibleNodeData(&node_data_regular); | 3135 textfield_->GetAccessibleNodeData(&node_data_regular); |
| 3136 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_regular.role); | 3136 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_regular.role); |
| 3137 EXPECT_EQ(ASCIIToUTF16("password"), | 3137 EXPECT_EQ(ASCIIToUTF16("password"), |
| 3138 node_data_regular.GetString16Attribute(ui::AX_ATTR_VALUE)); | 3138 node_data_regular.GetString16Attribute(ui::AX_ATTR_VALUE)); |
| 3139 EXPECT_FALSE(node_data_regular.HasState(ui::AX_STATE_PROTECTED)); | 3139 EXPECT_FALSE(node_data_regular.HasState(ui::AX_STATE_PROTECTED)); |
| 3140 | 3140 |
| 3141 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 3141 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 3142 ui::AXNodeData node_data_protected; | 3142 ui::AXNodeData node_data_protected; |
| 3143 textfield_->GetAccessibleNodeData(&node_data_protected); | 3143 textfield_->GetAccessibleNodeData(&node_data_protected); |
| 3144 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); | 3144 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); |
| 3145 #if defined(OS_MACOSX) |
| 3146 EXPECT_EQ(UTF8ToUTF16("••••••••"), |
| 3147 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); |
| 3148 #else |
| 3145 EXPECT_EQ(ASCIIToUTF16("********"), | 3149 EXPECT_EQ(ASCIIToUTF16("********"), |
| 3146 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); | 3150 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); |
| 3151 #endif |
| 3147 EXPECT_TRUE(node_data_protected.HasState(ui::AX_STATE_PROTECTED)); | 3152 EXPECT_TRUE(node_data_protected.HasState(ui::AX_STATE_PROTECTED)); |
| 3148 } | 3153 } |
| 3149 | 3154 |
| 3150 // Verify that cursor visibility is controlled by SetCursorEnabled. | 3155 // Verify that cursor visibility is controlled by SetCursorEnabled. |
| 3151 TEST_F(TextfieldTest, CursorVisibility) { | 3156 TEST_F(TextfieldTest, CursorVisibility) { |
| 3152 InitTextfield(); | 3157 InitTextfield(); |
| 3153 | 3158 |
| 3154 textfield_->SetCursorEnabled(false); | 3159 textfield_->SetCursorEnabled(false); |
| 3155 EXPECT_FALSE(test_api_->IsCursorVisible()); | 3160 EXPECT_FALSE(test_api_->IsCursorVisible()); |
| 3156 | 3161 |
| 3157 textfield_->SetCursorEnabled(true); | 3162 textfield_->SetCursorEnabled(true); |
| 3158 EXPECT_TRUE(test_api_->IsCursorVisible()); | 3163 EXPECT_TRUE(test_api_->IsCursorVisible()); |
| 3159 } | 3164 } |
| 3160 | 3165 |
| 3161 } // namespace views | 3166 } // namespace views |
| OLD | NEW |