Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: content/browser/renderer_host/input/touch_selection_controller_unittest.cc

Issue 616603004: Replacing the OVERRIDE with override and FINAL with final in content/browser/renderer_host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the patch Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/mock_motion_event.h" 8 #include "ui/events/test/mock_motion_event.h"
9 9
10 using ui::test::MockMotionEvent; 10 using ui::test::MockMotionEvent;
11 11
12 namespace content { 12 namespace content {
13 namespace { 13 namespace {
14 14
15 const int kDefaultTapTimeoutMs = 200; 15 const int kDefaultTapTimeoutMs = 200;
16 const float kDefaulTapSlop = 10.f; 16 const float kDefaulTapSlop = 10.f;
17 17
18 class MockTouchHandleDrawable : public TouchHandleDrawable { 18 class MockTouchHandleDrawable : public TouchHandleDrawable {
19 public: 19 public:
20 explicit MockTouchHandleDrawable(bool* contains_point) 20 explicit MockTouchHandleDrawable(bool* contains_point)
21 : intersects_rect_(contains_point) {} 21 : intersects_rect_(contains_point) {}
22 virtual ~MockTouchHandleDrawable() {} 22 virtual ~MockTouchHandleDrawable() {}
23 virtual void SetEnabled(bool enabled) OVERRIDE {} 23 virtual void SetEnabled(bool enabled) override {}
24 virtual void SetOrientation(TouchHandleOrientation orientation) OVERRIDE {} 24 virtual void SetOrientation(TouchHandleOrientation orientation) override {}
25 virtual void SetAlpha(float alpha) OVERRIDE {} 25 virtual void SetAlpha(float alpha) override {}
26 virtual void SetFocus(const gfx::PointF& position) OVERRIDE {} 26 virtual void SetFocus(const gfx::PointF& position) override {}
27 virtual void SetVisible(bool visible) OVERRIDE {} 27 virtual void SetVisible(bool visible) override {}
28 virtual bool IntersectsWith(const gfx::RectF& rect) const OVERRIDE { 28 virtual bool IntersectsWith(const gfx::RectF& rect) const override {
29 return *intersects_rect_; 29 return *intersects_rect_;
30 } 30 }
31 31
32 private: 32 private:
33 bool* intersects_rect_; 33 bool* intersects_rect_;
34 }; 34 };
35 35
36 } // namespace 36 } // namespace
37 37
38 class TouchSelectionControllerTest : public testing::Test, 38 class TouchSelectionControllerTest : public testing::Test,
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 virtual ~TouchSelectionControllerTest() {}
50 50
51 // testing::Test implementation. 51 // testing::Test implementation.
52 virtual void SetUp() OVERRIDE { 52 virtual 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 virtual void TearDown() override { controller_.reset(); }
60 60
61 // TouchSelectionControllerClient implementation. 61 // TouchSelectionControllerClient implementation.
62 62
63 virtual bool SupportsAnimation() const OVERRIDE { return animation_enabled_; } 63 virtual bool SupportsAnimation() const override { return animation_enabled_; }
64 64
65 virtual void SetNeedsAnimate() OVERRIDE { needs_animate_ = true; } 65 virtual void SetNeedsAnimate() override { needs_animate_ = true; }
66 66
67 virtual void MoveCaret(const gfx::PointF& position) OVERRIDE { 67 virtual void MoveCaret(const gfx::PointF& position) override {
68 caret_moved_ = true; 68 caret_moved_ = true;
69 caret_position_ = position; 69 caret_position_ = position;
70 } 70 }
71 71
72 virtual void SelectBetweenCoordinates(const gfx::PointF& start, 72 virtual void SelectBetweenCoordinates(const gfx::PointF& start,
73 const gfx::PointF& end) OVERRIDE { 73 const gfx::PointF& end) override {
74 selection_moved_ = true; 74 selection_moved_ = true;
75 selection_start_ = start; 75 selection_start_ = start;
76 selection_end_ = end; 76 selection_end_ = end;
77 } 77 }
78 78
79 virtual void OnSelectionEvent(SelectionEventType event, 79 virtual void OnSelectionEvent(SelectionEventType event,
80 const gfx::PointF& end_position) OVERRIDE { 80 const gfx::PointF& end_position) override {
81 last_event_ = event; 81 last_event_ = event;
82 last_event_start_ = end_position; 82 last_event_start_ = end_position;
83 } 83 }
84 84
85 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() OVERRIDE { 85 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() override {
86 return scoped_ptr<TouchHandleDrawable>( 86 return scoped_ptr<TouchHandleDrawable>(
87 new MockTouchHandleDrawable(&dragging_enabled_)); 87 new MockTouchHandleDrawable(&dragging_enabled_));
88 } 88 }
89 89
90 void SetAnimationEnabled(bool enabled) { animation_enabled_ = enabled; } 90 void SetAnimationEnabled(bool enabled) { animation_enabled_ = enabled; }
91 void SetDraggingEnabled(bool enabled) { dragging_enabled_ = enabled; } 91 void SetDraggingEnabled(bool enabled) { dragging_enabled_ = enabled; }
92 92
93 void ClearSelection() { 93 void ClearSelection() {
94 controller_->OnSelectionBoundsChanged(cc::ViewportSelectionBound(), 94 controller_->OnSelectionBoundsChanged(cc::ViewportSelectionBound(),
95 cc::ViewportSelectionBound()); 95 cc::ViewportSelectionBound());
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698