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

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

Issue 1087893003: Support longpress drag selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Factor out logic Created 5 years, 8 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 "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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 public: 67 public:
68 TouchHandleTest() 68 TouchHandleTest()
69 : dragging_(false), 69 : dragging_(false),
70 dragged_(false), 70 dragged_(false),
71 tapped_(false), 71 tapped_(false),
72 needs_animate_(false) {} 72 needs_animate_(false) {}
73 73
74 ~TouchHandleTest() override {} 74 ~TouchHandleTest() override {}
75 75
76 // TouchHandleClient implementation. 76 // TouchHandleClient implementation.
77 void OnHandleDragBegin(const TouchHandle& handle) override { 77 void OnDragBegin(const TouchSelectionDraggable& handler,
78 const gfx::PointF& drag_position) override {
78 dragging_ = true; 79 dragging_ = true;
79 } 80 }
80 81
81 void OnHandleDragUpdate(const TouchHandle& handle, 82 void OnDragUpdate(const TouchSelectionDraggable& handler,
82 const gfx::PointF& new_position) override { 83 const gfx::PointF& drag_position) override {
83 dragged_ = true; 84 dragged_ = true;
84 drag_position_ = new_position; 85 drag_position_ = drag_position;
85 } 86 }
86 87
87 void OnHandleDragEnd(const TouchHandle& handle) override { 88 void OnDragEnd(const TouchSelectionDraggable& handler) override {
88 dragging_ = false; 89 dragging_ = false;
89 } 90 }
90 91
91 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; } 92 void OnHandleTapped(const TouchHandle& handle) override { tapped_ = true; }
92 93
93 void SetNeedsAnimate() override { needs_animate_ = true; } 94 void SetNeedsAnimate() override { needs_animate_ = true; }
94 95
95 scoped_ptr<TouchHandleDrawable> CreateDrawable() override { 96 scoped_ptr<TouchHandleDrawable> CreateDrawable() override {
96 return make_scoped_ptr(new MockTouchHandleDrawable(&drawable_data_)); 97 return make_scoped_ptr(new MockTouchHandleDrawable(&drawable_data_));
97 } 98 }
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 event = MockMotionEvent( 499 event = MockMotionEvent(
499 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0); 500 MockMotionEvent::ACTION_MOVE, event_time, kDefaultTapSlop * 2.f, 0);
500 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); 501 EXPECT_TRUE(handle.WillHandleTouchEvent(event));
501 event = MockMotionEvent( 502 event = MockMotionEvent(
502 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0); 503 MockMotionEvent::ACTION_UP, event_time, kDefaultTapSlop * 2.f, 0);
503 EXPECT_TRUE(handle.WillHandleTouchEvent(event)); 504 EXPECT_TRUE(handle.WillHandleTouchEvent(event));
504 EXPECT_FALSE(GetAndResetHandleTapped()); 505 EXPECT_FALSE(GetAndResetHandleTapped());
505 } 506 }
506 507
507 } // namespace ui 508 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698