| OLD | NEW |
| 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/synthetic_gesture_controller.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 gfx::Vector2dF start_to_end_distance_; | 142 gfx::Vector2dF start_to_end_distance_; |
| 143 float total_abs_move_distance_length_; | 143 float total_abs_move_distance_length_; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 class MockScrollMouseTarget : public MockMoveGestureTarget { | 146 class MockScrollMouseTarget : public MockMoveGestureTarget { |
| 147 public: | 147 public: |
| 148 MockScrollMouseTarget() {} | 148 MockScrollMouseTarget() {} |
| 149 ~MockScrollMouseTarget() override {} | 149 ~MockScrollMouseTarget() override {} |
| 150 | 150 |
| 151 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 151 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 152 ASSERT_EQ(event.type, WebInputEvent::MouseWheel); | 152 ASSERT_EQ(event.type(), WebInputEvent::MouseWheel); |
| 153 const WebMouseWheelEvent& mouse_wheel_event = | 153 const WebMouseWheelEvent& mouse_wheel_event = |
| 154 static_cast<const WebMouseWheelEvent&>(event); | 154 static_cast<const WebMouseWheelEvent&>(event); |
| 155 gfx::Vector2dF delta(mouse_wheel_event.deltaX, mouse_wheel_event.deltaY); | 155 gfx::Vector2dF delta(mouse_wheel_event.deltaX, mouse_wheel_event.deltaY); |
| 156 start_to_end_distance_ += delta; | 156 start_to_end_distance_ += delta; |
| 157 total_abs_move_distance_length_ += delta.Length(); | 157 total_abs_move_distance_length_ += delta.Length(); |
| 158 } | 158 } |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 class MockMoveTouchTarget : public MockMoveGestureTarget { | 161 class MockMoveTouchTarget : public MockMoveGestureTarget { |
| 162 public: | 162 public: |
| 163 MockMoveTouchTarget() : started_(false) {} | 163 MockMoveTouchTarget() : started_(false) {} |
| 164 ~MockMoveTouchTarget() override {} | 164 ~MockMoveTouchTarget() override {} |
| 165 | 165 |
| 166 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 166 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 167 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type)); | 167 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type())); |
| 168 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); | 168 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); |
| 169 ASSERT_EQ(touch_event.touchesLength, 1U); | 169 ASSERT_EQ(touch_event.touchesLength, 1U); |
| 170 | 170 |
| 171 if (!started_) { | 171 if (!started_) { |
| 172 ASSERT_EQ(touch_event.type, WebInputEvent::TouchStart); | 172 ASSERT_EQ(touch_event.type(), WebInputEvent::TouchStart); |
| 173 start_.SetPoint(touch_event.touches[0].position.x, | 173 start_.SetPoint(touch_event.touches[0].position.x, |
| 174 touch_event.touches[0].position.y); | 174 touch_event.touches[0].position.y); |
| 175 last_touch_point_ = gfx::PointF(start_); | 175 last_touch_point_ = gfx::PointF(start_); |
| 176 started_ = true; | 176 started_ = true; |
| 177 } else { | 177 } else { |
| 178 ASSERT_NE(touch_event.type, WebInputEvent::TouchStart); | 178 ASSERT_NE(touch_event.type(), WebInputEvent::TouchStart); |
| 179 ASSERT_NE(touch_event.type, WebInputEvent::TouchCancel); | 179 ASSERT_NE(touch_event.type(), WebInputEvent::TouchCancel); |
| 180 | 180 |
| 181 gfx::PointF touch_point(touch_event.touches[0].position.x, | 181 gfx::PointF touch_point(touch_event.touches[0].position.x, |
| 182 touch_event.touches[0].position.y); | 182 touch_event.touches[0].position.y); |
| 183 gfx::Vector2dF delta = touch_point - last_touch_point_; | 183 gfx::Vector2dF delta = touch_point - last_touch_point_; |
| 184 total_abs_move_distance_length_ += delta.Length(); | 184 total_abs_move_distance_length_ += delta.Length(); |
| 185 | 185 |
| 186 if (touch_event.type == WebInputEvent::TouchEnd) | 186 if (touch_event.type() == WebInputEvent::TouchEnd) |
| 187 start_to_end_distance_ = touch_point - gfx::PointF(start_); | 187 start_to_end_distance_ = touch_point - gfx::PointF(start_); |
| 188 | 188 |
| 189 last_touch_point_ = touch_point; | 189 last_touch_point_ = touch_point; |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 protected: | 193 protected: |
| 194 gfx::Point start_; | 194 gfx::Point start_; |
| 195 gfx::PointF last_touch_point_; | 195 gfx::PointF last_touch_point_; |
| 196 bool started_; | 196 bool started_; |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 class MockDragMouseTarget : public MockMoveGestureTarget { | 199 class MockDragMouseTarget : public MockMoveGestureTarget { |
| 200 public: | 200 public: |
| 201 MockDragMouseTarget() : started_(false) {} | 201 MockDragMouseTarget() : started_(false) {} |
| 202 ~MockDragMouseTarget() override {} | 202 ~MockDragMouseTarget() override {} |
| 203 | 203 |
| 204 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 204 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 205 ASSERT_TRUE(WebInputEvent::isMouseEventType(event.type)); | 205 ASSERT_TRUE(WebInputEvent::isMouseEventType(event.type())); |
| 206 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); | 206 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); |
| 207 if (!started_) { | 207 if (!started_) { |
| 208 EXPECT_EQ(mouse_event.button, WebMouseEvent::Button::Left); | 208 EXPECT_EQ(mouse_event.button, WebMouseEvent::Button::Left); |
| 209 EXPECT_EQ(mouse_event.clickCount, 1); | 209 EXPECT_EQ(mouse_event.clickCount, 1); |
| 210 EXPECT_EQ(mouse_event.type, WebInputEvent::MouseDown); | 210 EXPECT_EQ(mouse_event.type(), WebInputEvent::MouseDown); |
| 211 start_.SetPoint(mouse_event.x, mouse_event.y); | 211 start_.SetPoint(mouse_event.x, mouse_event.y); |
| 212 last_mouse_point_ = start_; | 212 last_mouse_point_ = start_; |
| 213 started_ = true; | 213 started_ = true; |
| 214 } else { | 214 } else { |
| 215 EXPECT_EQ(mouse_event.button, WebMouseEvent::Button::Left); | 215 EXPECT_EQ(mouse_event.button, WebMouseEvent::Button::Left); |
| 216 ASSERT_NE(mouse_event.type, WebInputEvent::MouseDown); | 216 ASSERT_NE(mouse_event.type(), WebInputEvent::MouseDown); |
| 217 | 217 |
| 218 gfx::PointF mouse_point(mouse_event.x, mouse_event.y); | 218 gfx::PointF mouse_point(mouse_event.x, mouse_event.y); |
| 219 gfx::Vector2dF delta = mouse_point - last_mouse_point_; | 219 gfx::Vector2dF delta = mouse_point - last_mouse_point_; |
| 220 total_abs_move_distance_length_ += delta.Length(); | 220 total_abs_move_distance_length_ += delta.Length(); |
| 221 if (mouse_event.type == WebInputEvent::MouseUp) | 221 if (mouse_event.type() == WebInputEvent::MouseUp) |
| 222 start_to_end_distance_ = mouse_point - start_; | 222 start_to_end_distance_ = mouse_point - start_; |
| 223 last_mouse_point_ = mouse_point; | 223 last_mouse_point_ = mouse_point; |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 private: | 227 private: |
| 228 bool started_; | 228 bool started_; |
| 229 gfx::PointF start_, last_mouse_point_; | 229 gfx::PointF start_, last_mouse_point_; |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 class MockSyntheticTouchscreenPinchTouchTarget | 232 class MockSyntheticTouchscreenPinchTouchTarget |
| 233 : public MockSyntheticGestureTarget { | 233 : public MockSyntheticGestureTarget { |
| 234 public: | 234 public: |
| 235 enum ZoomDirection { | 235 enum ZoomDirection { |
| 236 ZOOM_DIRECTION_UNKNOWN, | 236 ZOOM_DIRECTION_UNKNOWN, |
| 237 ZOOM_IN, | 237 ZOOM_IN, |
| 238 ZOOM_OUT | 238 ZOOM_OUT |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 MockSyntheticTouchscreenPinchTouchTarget() | 241 MockSyntheticTouchscreenPinchTouchTarget() |
| 242 : initial_pointer_distance_(0), | 242 : initial_pointer_distance_(0), |
| 243 last_pointer_distance_(0), | 243 last_pointer_distance_(0), |
| 244 zoom_direction_(ZOOM_DIRECTION_UNKNOWN), | 244 zoom_direction_(ZOOM_DIRECTION_UNKNOWN), |
| 245 started_(false) {} | 245 started_(false) {} |
| 246 ~MockSyntheticTouchscreenPinchTouchTarget() override {} | 246 ~MockSyntheticTouchscreenPinchTouchTarget() override {} |
| 247 | 247 |
| 248 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 248 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 249 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type)); | 249 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type())); |
| 250 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); | 250 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); |
| 251 ASSERT_EQ(touch_event.touchesLength, 2U); | 251 ASSERT_EQ(touch_event.touchesLength, 2U); |
| 252 | 252 |
| 253 if (!started_) { | 253 if (!started_) { |
| 254 ASSERT_EQ(touch_event.type, WebInputEvent::TouchStart); | 254 ASSERT_EQ(touch_event.type(), WebInputEvent::TouchStart); |
| 255 | 255 |
| 256 start_0_ = gfx::PointF(touch_event.touches[0].position); | 256 start_0_ = gfx::PointF(touch_event.touches[0].position); |
| 257 start_1_ = gfx::PointF(touch_event.touches[1].position); | 257 start_1_ = gfx::PointF(touch_event.touches[1].position); |
| 258 last_pointer_distance_ = (start_0_ - start_1_).Length(); | 258 last_pointer_distance_ = (start_0_ - start_1_).Length(); |
| 259 initial_pointer_distance_ = last_pointer_distance_; | 259 initial_pointer_distance_ = last_pointer_distance_; |
| 260 EXPECT_GE(initial_pointer_distance_, GetMinScalingSpanInDips()); | 260 EXPECT_GE(initial_pointer_distance_, GetMinScalingSpanInDips()); |
| 261 | 261 |
| 262 started_ = true; | 262 started_ = true; |
| 263 } else { | 263 } else { |
| 264 ASSERT_NE(touch_event.type, WebInputEvent::TouchStart); | 264 ASSERT_NE(touch_event.type(), WebInputEvent::TouchStart); |
| 265 ASSERT_NE(touch_event.type, WebInputEvent::TouchCancel); | 265 ASSERT_NE(touch_event.type(), WebInputEvent::TouchCancel); |
| 266 | 266 |
| 267 gfx::PointF current_0 = gfx::PointF(touch_event.touches[0].position); | 267 gfx::PointF current_0 = gfx::PointF(touch_event.touches[0].position); |
| 268 gfx::PointF current_1 = gfx::PointF(touch_event.touches[1].position); | 268 gfx::PointF current_1 = gfx::PointF(touch_event.touches[1].position); |
| 269 | 269 |
| 270 float pointer_distance = (current_0 - current_1).Length(); | 270 float pointer_distance = (current_0 - current_1).Length(); |
| 271 | 271 |
| 272 if (last_pointer_distance_ != pointer_distance) { | 272 if (last_pointer_distance_ != pointer_distance) { |
| 273 if (zoom_direction_ == ZOOM_DIRECTION_UNKNOWN) | 273 if (zoom_direction_ == ZOOM_DIRECTION_UNKNOWN) |
| 274 zoom_direction_ = | 274 zoom_direction_ = |
| 275 ComputeZoomDirection(last_pointer_distance_, pointer_distance); | 275 ComputeZoomDirection(last_pointer_distance_, pointer_distance); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 enum ZoomDirection { ZOOM_DIRECTION_UNKNOWN, ZOOM_IN, ZOOM_OUT }; | 328 enum ZoomDirection { ZOOM_DIRECTION_UNKNOWN, ZOOM_IN, ZOOM_OUT }; |
| 329 | 329 |
| 330 MockSyntheticTouchpadPinchTouchTarget() | 330 MockSyntheticTouchpadPinchTouchTarget() |
| 331 : zoom_direction_(ZOOM_DIRECTION_UNKNOWN), | 331 : zoom_direction_(ZOOM_DIRECTION_UNKNOWN), |
| 332 started_(false), | 332 started_(false), |
| 333 ended_(false), | 333 ended_(false), |
| 334 scale_factor_(1.0f) {} | 334 scale_factor_(1.0f) {} |
| 335 ~MockSyntheticTouchpadPinchTouchTarget() override {} | 335 ~MockSyntheticTouchpadPinchTouchTarget() override {} |
| 336 | 336 |
| 337 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 337 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 338 EXPECT_TRUE(WebInputEvent::isGestureEventType(event.type)); | 338 EXPECT_TRUE(WebInputEvent::isGestureEventType(event.type())); |
| 339 const blink::WebGestureEvent& gesture_event = | 339 const blink::WebGestureEvent& gesture_event = |
| 340 static_cast<const blink::WebGestureEvent&>(event); | 340 static_cast<const blink::WebGestureEvent&>(event); |
| 341 | 341 |
| 342 if (gesture_event.type == WebInputEvent::GesturePinchBegin) { | 342 if (gesture_event.type() == WebInputEvent::GesturePinchBegin) { |
| 343 EXPECT_FALSE(started_); | 343 EXPECT_FALSE(started_); |
| 344 EXPECT_FALSE(ended_); | 344 EXPECT_FALSE(ended_); |
| 345 started_ = true; | 345 started_ = true; |
| 346 } else if (gesture_event.type == WebInputEvent::GesturePinchEnd) { | 346 } else if (gesture_event.type() == WebInputEvent::GesturePinchEnd) { |
| 347 EXPECT_TRUE(started_); | 347 EXPECT_TRUE(started_); |
| 348 EXPECT_FALSE(ended_); | 348 EXPECT_FALSE(ended_); |
| 349 ended_ = true; | 349 ended_ = true; |
| 350 } else { | 350 } else { |
| 351 EXPECT_EQ(WebInputEvent::GesturePinchUpdate, gesture_event.type); | 351 EXPECT_EQ(WebInputEvent::GesturePinchUpdate, gesture_event.type()); |
| 352 EXPECT_TRUE(started_); | 352 EXPECT_TRUE(started_); |
| 353 EXPECT_FALSE(ended_); | 353 EXPECT_FALSE(ended_); |
| 354 const float scale = gesture_event.data.pinchUpdate.scale; | 354 const float scale = gesture_event.data.pinchUpdate.scale; |
| 355 if (scale != 1.0f) { | 355 if (scale != 1.0f) { |
| 356 if (zoom_direction_ == ZOOM_DIRECTION_UNKNOWN) { | 356 if (zoom_direction_ == ZOOM_DIRECTION_UNKNOWN) { |
| 357 zoom_direction_ = scale > 1.0f ? ZOOM_IN : ZOOM_OUT; | 357 zoom_direction_ = scale > 1.0f ? ZOOM_IN : ZOOM_OUT; |
| 358 } else if (zoom_direction_ == ZOOM_IN) { | 358 } else if (zoom_direction_ == ZOOM_IN) { |
| 359 EXPECT_GT(scale, 1.0f); | 359 EXPECT_GT(scale, 1.0f); |
| 360 } else { | 360 } else { |
| 361 EXPECT_EQ(ZOOM_OUT, zoom_direction_); | 361 EXPECT_EQ(ZOOM_OUT, zoom_direction_); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 base::TimeDelta stop_time_; | 404 base::TimeDelta stop_time_; |
| 405 GestureState state_; | 405 GestureState state_; |
| 406 }; | 406 }; |
| 407 | 407 |
| 408 class MockSyntheticTapTouchTarget : public MockSyntheticTapGestureTarget { | 408 class MockSyntheticTapTouchTarget : public MockSyntheticTapGestureTarget { |
| 409 public: | 409 public: |
| 410 MockSyntheticTapTouchTarget() {} | 410 MockSyntheticTapTouchTarget() {} |
| 411 ~MockSyntheticTapTouchTarget() override {} | 411 ~MockSyntheticTapTouchTarget() override {} |
| 412 | 412 |
| 413 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 413 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 414 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type)); | 414 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type())); |
| 415 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); | 415 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); |
| 416 ASSERT_EQ(touch_event.touchesLength, 1U); | 416 ASSERT_EQ(touch_event.touchesLength, 1U); |
| 417 | 417 |
| 418 switch (state_) { | 418 switch (state_) { |
| 419 case NOT_STARTED: | 419 case NOT_STARTED: |
| 420 EXPECT_EQ(touch_event.type, WebInputEvent::TouchStart); | 420 EXPECT_EQ(touch_event.type(), WebInputEvent::TouchStart); |
| 421 position_ = gfx::PointF(touch_event.touches[0].position); | 421 position_ = gfx::PointF(touch_event.touches[0].position); |
| 422 start_time_ = base::TimeDelta::FromMilliseconds( | 422 start_time_ = base::TimeDelta::FromMilliseconds( |
| 423 static_cast<int64_t>(touch_event.timeStampSeconds * 1000)); | 423 static_cast<int64_t>(touch_event.timeStampSeconds() * 1000)); |
| 424 state_ = STARTED; | 424 state_ = STARTED; |
| 425 break; | 425 break; |
| 426 case STARTED: | 426 case STARTED: |
| 427 EXPECT_EQ(touch_event.type, WebInputEvent::TouchEnd); | 427 EXPECT_EQ(touch_event.type(), WebInputEvent::TouchEnd); |
| 428 EXPECT_EQ(position_, gfx::PointF(touch_event.touches[0].position)); | 428 EXPECT_EQ(position_, gfx::PointF(touch_event.touches[0].position)); |
| 429 stop_time_ = base::TimeDelta::FromMilliseconds( | 429 stop_time_ = base::TimeDelta::FromMilliseconds( |
| 430 static_cast<int64_t>(touch_event.timeStampSeconds * 1000)); | 430 static_cast<int64_t>(touch_event.timeStampSeconds() * 1000)); |
| 431 state_ = FINISHED; | 431 state_ = FINISHED; |
| 432 break; | 432 break; |
| 433 case FINISHED: | 433 case FINISHED: |
| 434 EXPECT_FALSE(true); | 434 EXPECT_FALSE(true); |
| 435 break; | 435 break; |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 }; | 438 }; |
| 439 | 439 |
| 440 class MockSyntheticTapMouseTarget : public MockSyntheticTapGestureTarget { | 440 class MockSyntheticTapMouseTarget : public MockSyntheticTapGestureTarget { |
| 441 public: | 441 public: |
| 442 MockSyntheticTapMouseTarget() {} | 442 MockSyntheticTapMouseTarget() {} |
| 443 ~MockSyntheticTapMouseTarget() override {} | 443 ~MockSyntheticTapMouseTarget() override {} |
| 444 | 444 |
| 445 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 445 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 446 ASSERT_TRUE(WebInputEvent::isMouseEventType(event.type)); | 446 ASSERT_TRUE(WebInputEvent::isMouseEventType(event.type())); |
| 447 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); | 447 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); |
| 448 | 448 |
| 449 switch (state_) { | 449 switch (state_) { |
| 450 case NOT_STARTED: | 450 case NOT_STARTED: |
| 451 EXPECT_EQ(mouse_event.type, WebInputEvent::MouseDown); | 451 EXPECT_EQ(mouse_event.type(), WebInputEvent::MouseDown); |
| 452 EXPECT_EQ(mouse_event.button, WebMouseEvent::Button::Left); | 452 EXPECT_EQ(mouse_event.button, WebMouseEvent::Button::Left); |
| 453 EXPECT_EQ(mouse_event.clickCount, 1); | 453 EXPECT_EQ(mouse_event.clickCount, 1); |
| 454 position_ = gfx::PointF(mouse_event.x, mouse_event.y); | 454 position_ = gfx::PointF(mouse_event.x, mouse_event.y); |
| 455 start_time_ = base::TimeDelta::FromMilliseconds( | 455 start_time_ = base::TimeDelta::FromMilliseconds( |
| 456 static_cast<int64_t>(mouse_event.timeStampSeconds * 1000)); | 456 static_cast<int64_t>(mouse_event.timeStampSeconds() * 1000)); |
| 457 state_ = STARTED; | 457 state_ = STARTED; |
| 458 break; | 458 break; |
| 459 case STARTED: | 459 case STARTED: |
| 460 EXPECT_EQ(mouse_event.type, WebInputEvent::MouseUp); | 460 EXPECT_EQ(mouse_event.type(), WebInputEvent::MouseUp); |
| 461 EXPECT_EQ(mouse_event.button, WebMouseEvent::Button::Left); | 461 EXPECT_EQ(mouse_event.button, WebMouseEvent::Button::Left); |
| 462 EXPECT_EQ(mouse_event.clickCount, 1); | 462 EXPECT_EQ(mouse_event.clickCount, 1); |
| 463 EXPECT_EQ(position_, gfx::PointF(mouse_event.x, mouse_event.y)); | 463 EXPECT_EQ(position_, gfx::PointF(mouse_event.x, mouse_event.y)); |
| 464 stop_time_ = base::TimeDelta::FromMilliseconds( | 464 stop_time_ = base::TimeDelta::FromMilliseconds( |
| 465 static_cast<int64_t>(mouse_event.timeStampSeconds * 1000)); | 465 static_cast<int64_t>(mouse_event.timeStampSeconds() * 1000)); |
| 466 state_ = FINISHED; | 466 state_ = FINISHED; |
| 467 break; | 467 break; |
| 468 case FINISHED: | 468 case FINISHED: |
| 469 EXPECT_FALSE(true); | 469 EXPECT_FALSE(true); |
| 470 break; | 470 break; |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 }; | 473 }; |
| 474 | 474 |
| 475 class MockSyntheticPointerActionTarget : public MockSyntheticGestureTarget { | 475 class MockSyntheticPointerActionTarget : public MockSyntheticGestureTarget { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 491 WebInputEvent::Type type_; | 491 WebInputEvent::Type type_; |
| 492 }; | 492 }; |
| 493 | 493 |
| 494 class MockSyntheticPointerTouchActionTarget | 494 class MockSyntheticPointerTouchActionTarget |
| 495 : public MockSyntheticPointerActionTarget { | 495 : public MockSyntheticPointerActionTarget { |
| 496 public: | 496 public: |
| 497 MockSyntheticPointerTouchActionTarget() {} | 497 MockSyntheticPointerTouchActionTarget() {} |
| 498 ~MockSyntheticPointerTouchActionTarget() override {} | 498 ~MockSyntheticPointerTouchActionTarget() override {} |
| 499 | 499 |
| 500 void DispatchInputEventToPlatform(const WebInputEvent& event) override { | 500 void DispatchInputEventToPlatform(const WebInputEvent& event) override { |
| 501 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type)); | 501 ASSERT_TRUE(WebInputEvent::isTouchEventType(event.type())); |
| 502 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); | 502 const WebTouchEvent& touch_event = static_cast<const WebTouchEvent&>(event); |
| 503 type_ = touch_event.type; | 503 type_ = touch_event.type(); |
| 504 for (size_t i = 0; i < touch_event.touchesLength; ++i) { | 504 for (size_t i = 0; i < touch_event.touchesLength; ++i) { |
| 505 indexes_[i] = touch_event.touches[i].id; | 505 indexes_[i] = touch_event.touches[i].id; |
| 506 positions_[i] = gfx::PointF(touch_event.touches[i].position); | 506 positions_[i] = gfx::PointF(touch_event.touches[i].position); |
| 507 states_[i] = touch_event.touches[i].state; | 507 states_[i] = touch_event.touches[i].state; |
| 508 } | 508 } |
| 509 touch_length_ = touch_event.touchesLength; | 509 touch_length_ = touch_event.touchesLength; |
| 510 } | 510 } |
| 511 }; | 511 }; |
| 512 | 512 |
| 513 class SyntheticGestureControllerTestBase { | 513 class SyntheticGestureControllerTestBase { |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 EXPECT_TRUE(tap_target->GestureFinished()); | 1467 EXPECT_TRUE(tap_target->GestureFinished()); |
| 1468 EXPECT_EQ(tap_target->position(), params.position); | 1468 EXPECT_EQ(tap_target->position(), params.position); |
| 1469 EXPECT_EQ(tap_target->GetDuration().InMilliseconds(), params.duration_ms); | 1469 EXPECT_EQ(tap_target->GetDuration().InMilliseconds(), params.duration_ms); |
| 1470 EXPECT_GE(GetTotalTime(), | 1470 EXPECT_GE(GetTotalTime(), |
| 1471 base::TimeDelta::FromMilliseconds(params.duration_ms)); | 1471 base::TimeDelta::FromMilliseconds(params.duration_ms)); |
| 1472 } | 1472 } |
| 1473 | 1473 |
| 1474 } // namespace | 1474 } // namespace |
| 1475 | 1475 |
| 1476 } // namespace content | 1476 } // namespace content |
| OLD | NEW |