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

Side by Side Diff: ui/touch_selection/touch_handle_unittest.cc

Issue 1424683002: Refactor TouchSelectionDraggableClient APIs Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « ui/touch_selection/touch_handle.cc ('k') | ui/touch_selection/touch_selection_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/touch_selection/touch_handle.h" 5 #include "ui/touch_selection/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/motion_event_test_utils.h" 8 #include "ui/events/test/motion_event_test_utils.h"
9 #include "ui/gfx/geometry/rect_f.h" 9 #include "ui/gfx/geometry/rect_f.h"
10 #include "ui/touch_selection/touch_handle_orientation.h" 10 #include "ui/touch_selection/touch_handle_orientation.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 public: 77 public:
78 TouchHandleTest() 78 TouchHandleTest()
79 : dragging_(false), 79 : dragging_(false),
80 dragged_(false), 80 dragged_(false),
81 tapped_(false), 81 tapped_(false),
82 needs_animate_(false) {} 82 needs_animate_(false) {}
83 83
84 ~TouchHandleTest() override {} 84 ~TouchHandleTest() override {}
85 85
86 // TouchHandleClient implementation. 86 // TouchHandleClient implementation.
87 void OnDragBegin(const TouchSelectionDraggable& handler, 87 void OnDragEvent(const TouchHandleDragEvent event,
88 const gfx::PointF& drag_position) override { 88 const TouchSelectionDraggable& draggable,
89 dragging_ = true; 89 const gfx::PointF& position) override {
90 } 90 switch (event) {
91 91 case HANDLE_DRAG_BEGIN:
92 void OnDragUpdate(const TouchSelectionDraggable& handler, 92 dragging_ = true;
93 const gfx::PointF& drag_position) override { 93 break;
94 dragged_ = true; 94 case HANDLE_DRAG_UPDATE:
95 drag_position_ = drag_position; 95 dragged_ = true;
96 } 96 drag_position_ = position;
97 97 break;
98 void OnDragEnd(const TouchSelectionDraggable& handler) override { 98 case HANDLE_DRAG_END:
99 dragging_ = false; 99 dragging_ = false;
100 default:
101 NOTREACHED() << "Invalid handle drag event";
102 }
100 } 103 }
101 104
102 bool IsWithinTapSlop(const gfx::Vector2dF& delta) const override { 105 bool IsWithinTapSlop(const gfx::Vector2dF& delta) const override {
103 return delta.LengthSquared() < (kDefaultTapSlop * kDefaultTapSlop); 106 return delta.LengthSquared() < (kDefaultTapSlop * kDefaultTapSlop);
104 } 107 }
105 108
106 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; } 109 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; }
107 110
108 void SetNeedsAnimate() override { needs_animate_ = true; } 111 void SetNeedsAnimate() override { needs_animate_ = true; }
109 112
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 UpdateViewportRect(handle, gfx::RectF(0, 0, 230, 600)); 681 UpdateViewportRect(handle, gfx::RectF(0, 0, 230, 600));
679 EXPECT_TRUE(drawable().mirror_vertical); 682 EXPECT_TRUE(drawable().mirror_vertical);
680 EXPECT_TRUE(drawable().mirror_horizontal); 683 EXPECT_TRUE(drawable().mirror_horizontal);
681 684
682 UpdateViewportRect(handle, kDefaultViewportRect); 685 UpdateViewportRect(handle, kDefaultViewportRect);
683 EXPECT_FALSE(drawable().mirror_vertical); 686 EXPECT_FALSE(drawable().mirror_vertical);
684 EXPECT_FALSE(drawable().mirror_horizontal); 687 EXPECT_FALSE(drawable().mirror_horizontal);
685 } 688 }
686 689
687 } // namespace ui 690 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_handle.cc ('k') | ui/touch_selection/touch_selection_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698