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

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

Issue 1645613007: Redefined the bit WebTouchEvent.causesScrollingIfUncanceled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed an aura unittest. Created 4 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_event_queue.h" 5 #include "content/browser/renderer_host/input/touch_event_queue.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 ResetQueueWithConfig(config); 98 ResetQueueWithConfig(config);
99 } 99 }
100 100
101 void SetUpForTimeoutTesting() { 101 void SetUpForTimeoutTesting() {
102 SetUpForTimeoutTesting(DefaultTouchTimeoutDelay(), 102 SetUpForTimeoutTesting(DefaultTouchTimeoutDelay(),
103 DefaultTouchTimeoutDelay()); 103 DefaultTouchTimeoutDelay());
104 } 104 }
105 105
106 void SendTouchEvent(WebTouchEvent event) { 106 void SendTouchEvent(WebTouchEvent event) {
107 if (slop_length_dips_) { 107 if (slop_length_dips_) {
108 event.causesScrollingIfUncanceled = false; 108 event.movedBeyondSlopRegion = false;
109 if (WebTouchEventTraits::IsTouchSequenceStart(event)) 109 if (WebTouchEventTraits::IsTouchSequenceStart(event))
110 anchor_ = event.touches[0].position; 110 anchor_ = event.touches[0].position;
111 if (event.type == WebInputEvent::TouchMove) { 111 if (event.type == WebInputEvent::TouchMove) {
112 gfx::Vector2dF delta = anchor_ - event.touches[0].position; 112 gfx::Vector2dF delta = anchor_ - event.touches[0].position;
113 if (delta.LengthSquared() > slop_length_dips_ * slop_length_dips_) 113 if (delta.LengthSquared() > slop_length_dips_ * slop_length_dips_)
114 event.causesScrollingIfUncanceled = true; 114 event.movedBeyondSlopRegion = true;
115 } 115 }
116 } else { 116 } else {
117 event.causesScrollingIfUncanceled = 117 event.movedBeyondSlopRegion = event.type == WebInputEvent::TouchMove;
118 event.type == WebInputEvent::TouchMove;
119 } 118 }
120 queue_->QueueEvent(TouchEventWithLatencyInfo(event, ui::LatencyInfo())); 119 queue_->QueueEvent(TouchEventWithLatencyInfo(event, ui::LatencyInfo()));
121 } 120 }
122 121
123 void SendGestureEvent(WebInputEvent::Type type) { 122 void SendGestureEvent(WebInputEvent::Type type) {
124 WebGestureEvent event; 123 WebGestureEvent event;
125 event.type = type; 124 event.type = type;
126 queue_->OnGestureScrollEvent( 125 queue_->OnGestureScrollEvent(
127 GestureEventWithLatencyInfo(event, ui::LatencyInfo())); 126 GestureEventWithLatencyInfo(event, ui::LatencyInfo()));
128 } 127 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 SendTouchEvent(); 182 SendTouchEvent();
184 } 183 }
185 184
186 void ChangeTouchPointRadius(int index, float radius_x, float radius_y) { 185 void ChangeTouchPointRadius(int index, float radius_x, float radius_y) {
187 CHECK_GE(index, 0); 186 CHECK_GE(index, 0);
188 CHECK_LT(index, touch_event_.touchesLengthCap); 187 CHECK_LT(index, touch_event_.touchesLengthCap);
189 WebTouchPoint& point = touch_event_.touches[index]; 188 WebTouchPoint& point = touch_event_.touches[index];
190 point.radiusX = radius_x; 189 point.radiusX = radius_x;
191 point.radiusY = radius_y; 190 point.radiusY = radius_y;
192 touch_event_.touches[index].state = WebTouchPoint::StateMoved; 191 touch_event_.touches[index].state = WebTouchPoint::StateMoved;
193 touch_event_.causesScrollingIfUncanceled = true; 192 touch_event_.movedBeyondSlopRegion = true;
194 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, 193 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove,
195 touch_event_.timeStampSeconds, 194 touch_event_.timeStampSeconds,
196 &touch_event_); 195 &touch_event_);
197 SendTouchEvent(); 196 SendTouchEvent();
198 } 197 }
199 198
200 void ChangeTouchPointRotationAngle(int index, float rotation_angle) { 199 void ChangeTouchPointRotationAngle(int index, float rotation_angle) {
201 CHECK_GE(index, 0); 200 CHECK_GE(index, 0);
202 CHECK_LT(index, touch_event_.touchesLengthCap); 201 CHECK_LT(index, touch_event_.touchesLengthCap);
203 WebTouchPoint& point = touch_event_.touches[index]; 202 WebTouchPoint& point = touch_event_.touches[index];
204 point.rotationAngle = rotation_angle; 203 point.rotationAngle = rotation_angle;
205 touch_event_.touches[index].state = WebTouchPoint::StateMoved; 204 touch_event_.touches[index].state = WebTouchPoint::StateMoved;
206 touch_event_.causesScrollingIfUncanceled = true; 205 touch_event_.movedBeyondSlopRegion = true;
207 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, 206 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove,
208 touch_event_.timeStampSeconds, 207 touch_event_.timeStampSeconds,
209 &touch_event_); 208 &touch_event_);
210 SendTouchEvent(); 209 SendTouchEvent();
211 } 210 }
212 211
213 void ChangeTouchPointForce(int index, float force) { 212 void ChangeTouchPointForce(int index, float force) {
214 CHECK_GE(index, 0); 213 CHECK_GE(index, 0);
215 CHECK_LT(index, touch_event_.touchesLengthCap); 214 CHECK_LT(index, touch_event_.touchesLengthCap);
216 WebTouchPoint& point = touch_event_.touches[index]; 215 WebTouchPoint& point = touch_event_.touches[index];
217 point.force = force; 216 point.force = force;
218 touch_event_.touches[index].state = WebTouchPoint::StateMoved; 217 touch_event_.touches[index].state = WebTouchPoint::StateMoved;
219 touch_event_.causesScrollingIfUncanceled = true; 218 touch_event_.movedBeyondSlopRegion = true;
220 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, 219 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove,
221 touch_event_.timeStampSeconds, 220 touch_event_.timeStampSeconds,
222 &touch_event_); 221 &touch_event_);
223 SendTouchEvent(); 222 SendTouchEvent();
224 } 223 }
225 224
226 void ReleaseTouchPoint(int index) { 225 void ReleaseTouchPoint(int index) {
227 touch_event_.ReleasePoint(index); 226 touch_event_.ReleasePoint(index);
228 SendTouchEvent(); 227 SendTouchEvent();
229 } 228 }
(...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 // TouchMove should be allowed and test for touches state. 2608 // TouchMove should be allowed and test for touches state.
2610 const WebTouchEvent& event2 = sent_event(); 2609 const WebTouchEvent& event2 = sent_event();
2611 EXPECT_EQ(WebInputEvent::TouchMove, event2.type); 2610 EXPECT_EQ(WebInputEvent::TouchMove, event2.type);
2612 EXPECT_EQ(WebTouchPoint::StateStationary, event2.touches[0].state); 2611 EXPECT_EQ(WebTouchPoint::StateStationary, event2.touches[0].state);
2613 EXPECT_EQ(WebTouchPoint::StateMoved, event2.touches[1].state); 2612 EXPECT_EQ(WebTouchPoint::StateMoved, event2.touches[1].state);
2614 EXPECT_EQ(1U, GetAndResetSentEventCount()); 2613 EXPECT_EQ(1U, GetAndResetSentEventCount());
2615 EXPECT_EQ(1U, GetAndResetAckedEventCount()); 2614 EXPECT_EQ(1U, GetAndResetAckedEventCount());
2616 } 2615 }
2617 2616
2618 } // namespace content 2617 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698