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 "content/browser/renderer_host/input/touch_selection_controller.h" | 5 #include "content/browser/renderer_host/input/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 28 matching lines...) Expand all Loading... |
39 public TouchSelectionControllerClient { | 39 public TouchSelectionControllerClient { |
40 public: | 40 public: |
41 TouchSelectionControllerTest() | 41 TouchSelectionControllerTest() |
42 : last_event_(SELECTION_CLEARED), | 42 : last_event_(SELECTION_CLEARED), |
43 caret_moved_(false), | 43 caret_moved_(false), |
44 selection_moved_(false), | 44 selection_moved_(false), |
45 needs_animate_(false), | 45 needs_animate_(false), |
46 animation_enabled_(true), | 46 animation_enabled_(true), |
47 dragging_enabled_(false) {} | 47 dragging_enabled_(false) {} |
48 | 48 |
49 virtual ~TouchSelectionControllerTest() {} | 49 ~TouchSelectionControllerTest() override {} |
50 | 50 |
51 // testing::Test implementation. | 51 // testing::Test implementation. |
52 virtual void SetUp() override { | 52 void SetUp() override { |
53 controller_.reset(new TouchSelectionController( | 53 controller_.reset(new TouchSelectionController( |
54 this, | 54 this, |
55 base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs), | 55 base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs), |
56 kDefaulTapSlop)); | 56 kDefaulTapSlop)); |
57 } | 57 } |
58 | 58 |
59 virtual void TearDown() override { controller_.reset(); } | 59 void TearDown() override { controller_.reset(); } |
60 | 60 |
61 // TouchSelectionControllerClient implementation. | 61 // TouchSelectionControllerClient implementation. |
62 | 62 |
63 bool SupportsAnimation() const override { return animation_enabled_; } | 63 bool SupportsAnimation() const override { return animation_enabled_; } |
64 | 64 |
65 void SetNeedsAnimate() override { needs_animate_ = true; } | 65 void SetNeedsAnimate() override { needs_animate_ = true; } |
66 | 66 |
67 void MoveCaret(const gfx::PointF& position) override { | 67 void MoveCaret(const gfx::PointF& position) override { |
68 caret_moved_ = true; | 68 caret_moved_ = true; |
69 caret_position_ = position; | 69 caret_position_ = position; |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 EXPECT_EQ(SELECTION_SHOWN, GetLastEventType()); | 670 EXPECT_EQ(SELECTION_SHOWN, GetLastEventType()); |
671 EXPECT_EQ(start_rect.bottom_left(), GetLastEventAnchor()); | 671 EXPECT_EQ(start_rect.bottom_left(), GetLastEventAnchor()); |
672 | 672 |
673 controller().OnTapEvent(); | 673 controller().OnTapEvent(); |
674 ClearSelection(); | 674 ClearSelection(); |
675 EXPECT_EQ(SELECTION_CLEARED, GetLastEventType()); | 675 EXPECT_EQ(SELECTION_CLEARED, GetLastEventType()); |
676 EXPECT_EQ(gfx::PointF(), GetLastEventAnchor()); | 676 EXPECT_EQ(gfx::PointF(), GetLastEventAnchor()); |
677 } | 677 } |
678 | 678 |
679 } // namespace content | 679 } // namespace content |
OLD | NEW |