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/touch_selection/touch_selection_controller.h" | 5 #include "ui/touch_selection/touch_selection_controller.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/events/test/motion_event_test_utils.h" | 8 #include "ui/events/test/motion_event_test_utils.h" |
9 | 9 |
10 using ui::test::MockMotionEvent; | 10 using ui::test::MockMotionEvent; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 selection_end_ = extent; | 90 selection_end_ = extent; |
91 } | 91 } |
92 | 92 |
93 void OnSelectionEvent(SelectionEventType event, | 93 void OnSelectionEvent(SelectionEventType event, |
94 const gfx::PointF& end_position) override { | 94 const gfx::PointF& end_position) override { |
95 last_event_ = event; | 95 last_event_ = event; |
96 last_event_start_ = end_position; | 96 last_event_start_ = end_position; |
97 } | 97 } |
98 | 98 |
99 scoped_ptr<TouchHandleDrawable> CreateDrawable() override { | 99 scoped_ptr<TouchHandleDrawable> CreateDrawable() override { |
100 return scoped_ptr<TouchHandleDrawable>( | 100 return make_scoped_ptr(new MockTouchHandleDrawable(&dragging_enabled_)); |
101 new MockTouchHandleDrawable(&dragging_enabled_)); | |
102 } | 101 } |
103 | 102 |
104 void AllowShowingOnTapForEmptyEditable() { | 103 void AllowShowingOnTapForEmptyEditable() { |
105 bool show_on_tap_for_empty_editable = true; | 104 bool show_on_tap_for_empty_editable = true; |
106 controller_.reset(new TouchSelectionController( | 105 controller_.reset(new TouchSelectionController( |
107 this, | 106 this, |
108 base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs), | 107 base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs), |
109 kDefaulTapSlop, | 108 kDefaulTapSlop, |
110 show_on_tap_for_empty_editable)); | 109 show_on_tap_for_empty_editable)); |
111 } | 110 } |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 controller().OnSelectionEmpty(false); | 900 controller().OnSelectionEmpty(false); |
902 controller().HideAndDisallowShowingAutomatically(); | 901 controller().HideAndDisallowShowingAutomatically(); |
903 gfx::RectF insertion_rect(5, 5, 0, 10); | 902 gfx::RectF insertion_rect(5, 5, 0, 10); |
904 ChangeInsertion(insertion_rect, visible); | 903 ChangeInsertion(insertion_rect, visible); |
905 controller().AllowShowingFromCurrentSelection(); | 904 controller().AllowShowingFromCurrentSelection(); |
906 EXPECT_EQ(INSERTION_SHOWN, GetLastEventType()); | 905 EXPECT_EQ(INSERTION_SHOWN, GetLastEventType()); |
907 EXPECT_EQ(insertion_rect.bottom_left(), GetLastEventAnchor()); | 906 EXPECT_EQ(insertion_rect.bottom_left(), GetLastEventAnchor()); |
908 } | 907 } |
909 | 908 |
910 } // namespace ui | 909 } // namespace ui |
OLD | NEW |