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

Side by Side Diff: content/browser/renderer_host/input/touch_handle_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_handle.h" 5 #include "content/browser/renderer_host/input/touch_handle.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 #include "ui/gfx/geometry/rect_f.h" 9 #include "ui/gfx/geometry/rect_f.h"
10 10
(...skipping 18 matching lines...) Expand all
29 bool enabled; 29 bool enabled;
30 bool visible; 30 bool visible;
31 gfx::RectF rect; 31 gfx::RectF rect;
32 }; 32 };
33 33
34 class MockTouchHandleDrawable : public TouchHandleDrawable { 34 class MockTouchHandleDrawable : public TouchHandleDrawable {
35 public: 35 public:
36 explicit MockTouchHandleDrawable(MockDrawableData* data) : data_(data) {} 36 explicit MockTouchHandleDrawable(MockDrawableData* data) : data_(data) {}
37 virtual ~MockTouchHandleDrawable() {} 37 virtual ~MockTouchHandleDrawable() {}
38 38
39 virtual void SetEnabled(bool enabled) OVERRIDE { data_->enabled = enabled; } 39 virtual void SetEnabled(bool enabled) override { data_->enabled = enabled; }
40 40
41 virtual void SetOrientation(TouchHandleOrientation orientation) OVERRIDE { 41 virtual void SetOrientation(TouchHandleOrientation orientation) override {
42 data_->orientation = orientation; 42 data_->orientation = orientation;
43 } 43 }
44 44
45 virtual void SetAlpha(float alpha) OVERRIDE { data_->alpha = alpha; } 45 virtual void SetAlpha(float alpha) override { data_->alpha = alpha; }
46 46
47 virtual void SetFocus(const gfx::PointF& position) OVERRIDE { 47 virtual void SetFocus(const gfx::PointF& position) override {
48 // Anchor focus to the top left of the rect (regardless of orientation). 48 // Anchor focus to the top left of the rect (regardless of orientation).
49 data_->rect.set_origin(position); 49 data_->rect.set_origin(position);
50 } 50 }
51 51
52 virtual void SetVisible(bool visible) OVERRIDE { data_->visible = visible; } 52 virtual void SetVisible(bool visible) override { data_->visible = visible; }
53 53
54 virtual bool IntersectsWith(const gfx::RectF& rect) const OVERRIDE { 54 virtual bool IntersectsWith(const gfx::RectF& rect) const override {
55 return data_->rect.Intersects(rect); 55 return data_->rect.Intersects(rect);
56 } 56 }
57 57
58 private: 58 private:
59 MockDrawableData* data_; 59 MockDrawableData* data_;
60 }; 60 };
61 61
62 } // namespace 62 } // namespace
63 63
64 class TouchHandleTest : public testing::Test, public TouchHandleClient { 64 class TouchHandleTest : public testing::Test, public TouchHandleClient {
65 public: 65 public:
66 TouchHandleTest() 66 TouchHandleTest()
67 : dragging_(false), 67 : dragging_(false),
68 dragged_(false), 68 dragged_(false),
69 tapped_(false), 69 tapped_(false),
70 needs_animate_(false) {} 70 needs_animate_(false) {}
71 71
72 virtual ~TouchHandleTest() {} 72 virtual ~TouchHandleTest() {}
73 73
74 // TouchHandleClient implementation. 74 // TouchHandleClient implementation.
75 virtual void OnHandleDragBegin(const TouchHandle& handle) OVERRIDE { 75 virtual void OnHandleDragBegin(const TouchHandle& handle) override {
76 dragging_ = true; 76 dragging_ = true;
77 } 77 }
78 78
79 virtual void OnHandleDragUpdate(const TouchHandle& handle, 79 virtual void OnHandleDragUpdate(const TouchHandle& handle,
80 const gfx::PointF& new_position) OVERRIDE { 80 const gfx::PointF& new_position) override {
81 dragged_ = true; 81 dragged_ = true;
82 drag_position_ = new_position; 82 drag_position_ = new_position;
83 } 83 }
84 84
85 virtual void OnHandleDragEnd(const TouchHandle& handle) OVERRIDE { 85 virtual void OnHandleDragEnd(const TouchHandle& handle) override {
86 dragging_ = false; 86 dragging_ = false;
87 } 87 }
88 88
89 virtual void OnHandleTapped(const TouchHandle& handle) OVERRIDE { 89 virtual void OnHandleTapped(const TouchHandle& handle) override {
90 tapped_ = true; 90 tapped_ = true;
91 } 91 }
92 92
93 virtual void SetNeedsAnimate() OVERRIDE { needs_animate_ = true; } 93 virtual void SetNeedsAnimate() override { needs_animate_ = true; }
94 94
95 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() OVERRIDE { 95 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() override {
96 return scoped_ptr<TouchHandleDrawable>( 96 return scoped_ptr<TouchHandleDrawable>(
97 new MockTouchHandleDrawable(&drawable_data_)); 97 new MockTouchHandleDrawable(&drawable_data_));
98 } 98 }
99 99
100 virtual base::TimeDelta GetTapTimeout() const OVERRIDE { 100 virtual base::TimeDelta GetTapTimeout() const override {
101 return base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs); 101 return base::TimeDelta::FromMilliseconds(kDefaultTapTimeoutMs);
102 } 102 }
103 103
104 virtual float GetTapSlop() const OVERRIDE { return kDefaultTapSlop; } 104 virtual float GetTapSlop() const override { return kDefaultTapSlop; }
105 105
106 void Animate(TouchHandle& handle) { 106 void Animate(TouchHandle& handle) {
107 needs_animate_ = false; 107 needs_animate_ = false;
108 base::TimeTicks now = base::TimeTicks::Now(); 108 base::TimeTicks now = base::TimeTicks::Now();
109 while (handle.Animate(now)) 109 while (handle.Animate(now))
110 now += base::TimeDelta::FromMilliseconds(16); 110 now += base::TimeDelta::FromMilliseconds(16);
111 } 111 }
112 112
113 bool GetAndResetHandleDragged() { 113 bool GetAndResetHandleDragged() {
114 bool dragged = dragged_; 114 bool dragged = dragged_;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 event = MockMotionEvent( 484 event = MockMotionEvent(
485 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0); 485 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0);
486 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); 486 EXPECT_TRUE(handle.WillHandleTouchEvent(event));
487 event = MockMotionEvent( 487 event = MockMotionEvent(
488 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0); 488 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0);
489 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); 489 EXPECT_TRUE(handle.WillHandleTouchEvent(event));
490 EXPECT_FALSE(GetAndResetHandleTapped()); 490 EXPECT_FALSE(GetAndResetHandleTapped());
491 } 491 }
492 492
493 } // namespace content 493 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698