| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 EXPECT_TRUE(textfield_->GetSelectedText().empty()); | 809 EXPECT_TRUE(textfield_->GetSelectedText().empty()); |
| 810 textfield_view_->OnMousePressed(double_click); | 810 textfield_view_->OnMousePressed(double_click); |
| 811 textfield_view_->OnMouseReleased(release); | 811 textfield_view_->OnMouseReleased(release); |
| 812 EXPECT_STR_EQ("hello", textfield_->GetSelectedText()); | 812 EXPECT_STR_EQ("hello", textfield_->GetSelectedText()); |
| 813 | 813 |
| 814 // Test for triple click. | 814 // Test for triple click. |
| 815 textfield_view_->OnMousePressed(click); | 815 textfield_view_->OnMousePressed(click); |
| 816 textfield_view_->OnMouseReleased(release); | 816 textfield_view_->OnMouseReleased(release); |
| 817 EXPECT_STR_EQ("hello world", textfield_->GetSelectedText()); | 817 EXPECT_STR_EQ("hello world", textfield_->GetSelectedText()); |
| 818 | 818 |
| 819 // Another click should reset back to single click. | 819 // Another click should reset back to double click. |
| 820 textfield_view_->OnMousePressed(click); | 820 textfield_view_->OnMousePressed(click); |
| 821 textfield_view_->OnMouseReleased(release); | 821 textfield_view_->OnMouseReleased(release); |
| 822 EXPECT_TRUE(textfield_->GetSelectedText().empty()); | 822 EXPECT_STR_EQ("hello", textfield_->GetSelectedText()); |
| 823 } | 823 } |
| 824 | 824 |
| 825 TEST_F(NativeTextfieldViewsTest, DragToSelect) { | 825 TEST_F(NativeTextfieldViewsTest, DragToSelect) { |
| 826 InitTextfield(Textfield::STYLE_DEFAULT); | 826 InitTextfield(Textfield::STYLE_DEFAULT); |
| 827 textfield_->SetText(ASCIIToUTF16("hello world")); | 827 textfield_->SetText(ASCIIToUTF16("hello world")); |
| 828 const int kStart = GetCursorPositionX(5); | 828 const int kStart = GetCursorPositionX(5); |
| 829 const int kEnd = 500; | 829 const int kEnd = 500; |
| 830 gfx::Point start_point(kStart, 0); | 830 gfx::Point start_point(kStart, 0); |
| 831 gfx::Point end_point(kEnd, 0); | 831 gfx::Point end_point(kEnd, 0); |
| 832 ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, start_point, start_point, | 832 ui::MouseEvent click_a(ui::ET_MOUSE_PRESSED, start_point, start_point, |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 switches::kEnableTouchDragDrop); | 1902 switches::kEnableTouchDragDrop); |
| 1903 | 1903 |
| 1904 // Create a long press event in the selected region should start a drag. | 1904 // Create a long press event in the selected region should start a drag. |
| 1905 GestureEventForTest long_press(ui::ET_GESTURE_LONG_PRESS, | 1905 GestureEventForTest long_press(ui::ET_GESTURE_LONG_PRESS, |
| 1906 kStringPoint.x(), kStringPoint.y(), 0); | 1906 kStringPoint.x(), kStringPoint.y(), 0); |
| 1907 textfield_view_->OnGestureEvent(&long_press); | 1907 textfield_view_->OnGestureEvent(&long_press); |
| 1908 EXPECT_TRUE(textfield_view_->CanStartDragForView(NULL, | 1908 EXPECT_TRUE(textfield_view_->CanStartDragForView(NULL, |
| 1909 kStringPoint, kStringPoint)); | 1909 kStringPoint, kStringPoint)); |
| 1910 } | 1910 } |
| 1911 } // namespace views | 1911 } // namespace views |
| OLD | NEW |