| 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 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3105 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 3105 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 3106 ui::AXNodeData node_data_protected; | 3106 ui::AXNodeData node_data_protected; |
| 3107 node_data_protected.state = 0; | 3107 node_data_protected.state = 0; |
| 3108 textfield_->GetAccessibleNodeData(&node_data_protected); | 3108 textfield_->GetAccessibleNodeData(&node_data_protected); |
| 3109 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); | 3109 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); |
| 3110 EXPECT_EQ(ASCIIToUTF16("********"), | 3110 EXPECT_EQ(ASCIIToUTF16("********"), |
| 3111 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); | 3111 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); |
| 3112 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 3112 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
| 3113 } | 3113 } |
| 3114 | 3114 |
| 3115 // Test if the cursor visibility is controlled by |cursor_enabled_| in |
| 3116 // RenderText. |
| 3117 TEST_F(TextfieldTest, CursorVisibility) { |
| 3118 InitTextfield(); |
| 3119 gfx::RenderText* render_text = test_api_->GetRenderText(); |
| 3120 |
| 3121 render_text->SetCursorEnabled(false); |
| 3122 textfield_->OnBlur(); |
| 3123 textfield_->OnFocus(); |
| 3124 EXPECT_FALSE(test_api_->IsCursorVisible()); |
| 3125 |
| 3126 render_text->SetCursorEnabled(true); |
| 3127 textfield_->OnBlur(); |
| 3128 textfield_->OnFocus(); |
| 3129 EXPECT_TRUE(test_api_->IsCursorVisible()); |
| 3130 } |
| 3131 |
| 3115 } // namespace views | 3132 } // namespace views |
| OLD | NEW |