| 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 EXPECT_EQ(gfx::Range(4, 7), textfield_->GetSelectedRange()); | 1800 EXPECT_EQ(gfx::Range(4, 7), textfield_->GetSelectedRange()); |
| 1801 | 1801 |
| 1802 // Drag the mouse to the beginning of the textfield. | 1802 // Drag the mouse to the beginning of the textfield. |
| 1803 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, beginning, beginning, | 1803 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, beginning, beginning, |
| 1804 ui::EF_LEFT_MOUSE_BUTTON, 0); | 1804 ui::EF_LEFT_MOUSE_BUTTON, 0); |
| 1805 textfield_->OnMouseDragged(drag_event); | 1805 textfield_->OnMouseDragged(drag_event); |
| 1806 EXPECT_EQ(gfx::Range(7, 0), textfield_->GetSelectedRange()); | 1806 EXPECT_EQ(gfx::Range(7, 0), textfield_->GetSelectedRange()); |
| 1807 } | 1807 } |
| 1808 | 1808 |
| 1809 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1809 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1810 TEST_F(TextfieldTest, SelectionClipboard) { | 1810 // flaky: http://crbug.com/396477 |
| 1811 TEST_F(TextfieldTest, DISABLED_SelectionClipboard) { |
| 1811 InitTextfield(); | 1812 InitTextfield(); |
| 1812 textfield_->SetText(ASCIIToUTF16("0123")); | 1813 textfield_->SetText(ASCIIToUTF16("0123")); |
| 1813 gfx::Point point_1(GetCursorPositionX(1), 0); | 1814 gfx::Point point_1(GetCursorPositionX(1), 0); |
| 1814 gfx::Point point_2(GetCursorPositionX(2), 0); | 1815 gfx::Point point_2(GetCursorPositionX(2), 0); |
| 1815 gfx::Point point_3(GetCursorPositionX(3), 0); | 1816 gfx::Point point_3(GetCursorPositionX(3), 0); |
| 1816 gfx::Point point_4(GetCursorPositionX(4), 0); | 1817 gfx::Point point_4(GetCursorPositionX(4), 0); |
| 1817 | 1818 |
| 1818 // Text selected by the mouse should be placed on the selection clipboard. | 1819 // Text selected by the mouse should be placed on the selection clipboard. |
| 1819 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, point_1, point_1, | 1820 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, point_1, point_1, |
| 1820 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 1821 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 TextfieldDestroyerController controller(textfield_); | 2062 TextfieldDestroyerController controller(textfield_); |
| 2062 EXPECT_TRUE(controller.target()); | 2063 EXPECT_TRUE(controller.target()); |
| 2063 | 2064 |
| 2064 // Send a key to trigger OnKeyEvent(). | 2065 // Send a key to trigger OnKeyEvent(). |
| 2065 SendKeyEvent('X'); | 2066 SendKeyEvent('X'); |
| 2066 | 2067 |
| 2067 EXPECT_FALSE(controller.target()); | 2068 EXPECT_FALSE(controller.target()); |
| 2068 } | 2069 } |
| 2069 | 2070 |
| 2070 } // namespace views | 2071 } // namespace views |
| OLD | NEW |