| 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 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText()); | 1492 EXPECT_EQ(textfield_->text(), textfield_->GetSelectedText()); |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 // This test checks that dragging above the textfield selects to the beginning | 1495 // This test checks that dragging above the textfield selects to the beginning |
| 1496 // and dragging below the textfield selects to the end, but only on platforms | 1496 // and dragging below the textfield selects to the end, but only on platforms |
| 1497 // where that is the expected behavior. | 1497 // where that is the expected behavior. |
| 1498 TEST_F(TextfieldTest, DragUpOrDownSelectsToEnd) { | 1498 TEST_F(TextfieldTest, DragUpOrDownSelectsToEnd) { |
| 1499 InitTextfield(); | 1499 InitTextfield(); |
| 1500 textfield_->SetText(ASCIIToUTF16("hello world")); | 1500 textfield_->SetText(ASCIIToUTF16("hello world")); |
| 1501 const base::string16 expected_up = base::ASCIIToUTF16( | 1501 const base::string16 expected_up = base::ASCIIToUTF16( |
| 1502 PlatformStyle::kTextfieldDragVerticallyDragsToEnd ? "hello" : "lo"); | 1502 PlatformStyle::kTextDragVerticallyDragsToEnd ? "hello" : "lo"); |
| 1503 const base::string16 expected_down = base::ASCIIToUTF16( | 1503 const base::string16 expected_down = base::ASCIIToUTF16( |
| 1504 PlatformStyle::kTextfieldDragVerticallyDragsToEnd ? " world" : " w"); | 1504 PlatformStyle::kTextDragVerticallyDragsToEnd ? " world" : " w"); |
| 1505 const int kStartX = GetCursorPositionX(5); | 1505 const int kStartX = GetCursorPositionX(5); |
| 1506 const int kDownX = GetCursorPositionX(7); | 1506 const int kDownX = GetCursorPositionX(7); |
| 1507 const int kUpX = GetCursorPositionX(3); | 1507 const int kUpX = GetCursorPositionX(3); |
| 1508 gfx::Point start_point(kStartX, 0); | 1508 gfx::Point start_point(kStartX, 0); |
| 1509 gfx::Point down_point(kDownX, 500); | 1509 gfx::Point down_point(kDownX, 500); |
| 1510 gfx::Point up_point(kUpX, -500); | 1510 gfx::Point up_point(kUpX, -500); |
| 1511 | 1511 |
| 1512 MoveMouseTo(start_point); | 1512 MoveMouseTo(start_point); |
| 1513 PressLeftMouseButton(); | 1513 PressLeftMouseButton(); |
| 1514 DragMouseTo(up_point); | 1514 DragMouseTo(up_point); |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3009 ui::AXNodeData node_data_protected; | 3009 ui::AXNodeData node_data_protected; |
| 3010 node_data_protected.state = 0; | 3010 node_data_protected.state = 0; |
| 3011 textfield_->GetAccessibleNodeData(&node_data_protected); | 3011 textfield_->GetAccessibleNodeData(&node_data_protected); |
| 3012 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); | 3012 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); |
| 3013 EXPECT_EQ(ASCIIToUTF16("********"), | 3013 EXPECT_EQ(ASCIIToUTF16("********"), |
| 3014 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); | 3014 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); |
| 3015 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 3015 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
| 3016 } | 3016 } |
| 3017 | 3017 |
| 3018 } // namespace views | 3018 } // namespace views |
| OLD | NEW |