| OLD | NEW |
| 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 "components/test_runner/event_sender.h" | 5 #include "components/test_runner/event_sender.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 float velocity_x, | 457 float velocity_x, |
| 458 float velocity_y, | 458 float velocity_y, |
| 459 gin::Arguments* args); | 459 gin::Arguments* args); |
| 460 bool IsFlinging() const; | 460 bool IsFlinging() const; |
| 461 void GestureScrollFirstPoint(int x, int y); | 461 void GestureScrollFirstPoint(int x, int y); |
| 462 void TouchStart(); | 462 void TouchStart(); |
| 463 void TouchMove(); | 463 void TouchMove(); |
| 464 void TouchMoveCausingScrollIfUncanceled(); | 464 void TouchMoveCausingScrollIfUncanceled(); |
| 465 void TouchCancel(); | 465 void TouchCancel(); |
| 466 void TouchEnd(); | 466 void TouchEnd(); |
| 467 void NotifyStartOfTouchScroll(); |
| 467 void LeapForward(int milliseconds); | 468 void LeapForward(int milliseconds); |
| 468 double LastEventTimestamp(); | 469 double LastEventTimestamp(); |
| 469 void BeginDragWithFiles(const std::vector<std::string>& files); | 470 void BeginDragWithFiles(const std::vector<std::string>& files); |
| 470 void AddTouchPoint(double x, double y, gin::Arguments* args); | 471 void AddTouchPoint(double x, double y, gin::Arguments* args); |
| 471 void GestureScrollBegin(gin::Arguments* args); | 472 void GestureScrollBegin(gin::Arguments* args); |
| 472 void GestureScrollEnd(gin::Arguments* args); | 473 void GestureScrollEnd(gin::Arguments* args); |
| 473 void GestureScrollUpdate(gin::Arguments* args); | 474 void GestureScrollUpdate(gin::Arguments* args); |
| 474 void GesturePinchBegin(gin::Arguments* args); | 475 void GesturePinchBegin(gin::Arguments* args); |
| 475 void GesturePinchEnd(gin::Arguments* args); | 476 void GesturePinchEnd(gin::Arguments* args); |
| 476 void GesturePinchUpdate(gin::Arguments* args); | 477 void GesturePinchUpdate(gin::Arguments* args); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) | 579 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) |
| 579 .SetMethod("dumpFilenameBeingDragged", | 580 .SetMethod("dumpFilenameBeingDragged", |
| 580 &EventSenderBindings::DumpFilenameBeingDragged) | 581 &EventSenderBindings::DumpFilenameBeingDragged) |
| 581 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel) | 582 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel) |
| 582 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart) | 583 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart) |
| 583 .SetMethod("isFlinging", &EventSenderBindings::IsFlinging) | 584 .SetMethod("isFlinging", &EventSenderBindings::IsFlinging) |
| 584 .SetMethod("gestureScrollFirstPoint", | 585 .SetMethod("gestureScrollFirstPoint", |
| 585 &EventSenderBindings::GestureScrollFirstPoint) | 586 &EventSenderBindings::GestureScrollFirstPoint) |
| 586 .SetMethod("touchStart", &EventSenderBindings::TouchStart) | 587 .SetMethod("touchStart", &EventSenderBindings::TouchStart) |
| 587 .SetMethod("touchMove", &EventSenderBindings::TouchMove) | 588 .SetMethod("touchMove", &EventSenderBindings::TouchMove) |
| 588 .SetMethod("touchMoveCausingScrollIfUncanceled", | |
| 589 &EventSenderBindings::TouchMoveCausingScrollIfUncanceled) | |
| 590 .SetMethod("touchCancel", &EventSenderBindings::TouchCancel) | 589 .SetMethod("touchCancel", &EventSenderBindings::TouchCancel) |
| 591 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) | 590 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) |
| 591 .SetMethod("notifyStartOfTouchScroll", |
| 592 &EventSenderBindings::NotifyStartOfTouchScroll) |
| 592 .SetMethod("leapForward", &EventSenderBindings::LeapForward) | 593 .SetMethod("leapForward", &EventSenderBindings::LeapForward) |
| 593 .SetMethod("lastEventTimestamp", &EventSenderBindings::LastEventTimestamp) | 594 .SetMethod("lastEventTimestamp", &EventSenderBindings::LastEventTimestamp) |
| 594 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) | 595 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) |
| 595 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) | 596 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) |
| 596 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) | 597 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) |
| 597 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) | 598 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) |
| 598 .SetMethod("gestureScrollUpdate", | 599 .SetMethod("gestureScrollUpdate", |
| 599 &EventSenderBindings::GestureScrollUpdate) | 600 &EventSenderBindings::GestureScrollUpdate) |
| 600 .SetMethod("gesturePinchBegin", &EventSenderBindings::GesturePinchBegin) | 601 .SetMethod("gesturePinchBegin", &EventSenderBindings::GesturePinchBegin) |
| 601 .SetMethod("gesturePinchEnd", &EventSenderBindings::GesturePinchEnd) | 602 .SetMethod("gesturePinchEnd", &EventSenderBindings::GesturePinchEnd) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 void EventSenderBindings::TouchStart() { | 763 void EventSenderBindings::TouchStart() { |
| 763 if (sender_) | 764 if (sender_) |
| 764 sender_->TouchStart(); | 765 sender_->TouchStart(); |
| 765 } | 766 } |
| 766 | 767 |
| 767 void EventSenderBindings::TouchMove() { | 768 void EventSenderBindings::TouchMove() { |
| 768 if (sender_) | 769 if (sender_) |
| 769 sender_->TouchMove(); | 770 sender_->TouchMove(); |
| 770 } | 771 } |
| 771 | 772 |
| 772 void EventSenderBindings::TouchMoveCausingScrollIfUncanceled() { | |
| 773 if (sender_) | |
| 774 sender_->TouchMoveCausingScrollIfUncanceled(); | |
| 775 } | |
| 776 | |
| 777 void EventSenderBindings::TouchCancel() { | 773 void EventSenderBindings::TouchCancel() { |
| 778 if (sender_) | 774 if (sender_) |
| 779 sender_->TouchCancel(); | 775 sender_->TouchCancel(); |
| 780 } | 776 } |
| 781 | 777 |
| 782 void EventSenderBindings::TouchEnd() { | 778 void EventSenderBindings::TouchEnd() { |
| 783 if (sender_) | 779 if (sender_) |
| 784 sender_->TouchEnd(); | 780 sender_->TouchEnd(); |
| 785 } | 781 } |
| 786 | 782 |
| 783 void EventSenderBindings::NotifyStartOfTouchScroll() { |
| 784 if (sender_) |
| 785 sender_->NotifyStartOfTouchScroll(); |
| 786 } |
| 787 |
| 787 void EventSenderBindings::LeapForward(int milliseconds) { | 788 void EventSenderBindings::LeapForward(int milliseconds) { |
| 788 if (sender_) | 789 if (sender_) |
| 789 sender_->LeapForward(milliseconds); | 790 sender_->LeapForward(milliseconds); |
| 790 } | 791 } |
| 791 | 792 |
| 792 double EventSenderBindings::LastEventTimestamp() { | 793 double EventSenderBindings::LastEventTimestamp() { |
| 793 if (sender_) | 794 if (sender_) |
| 794 return sender_->last_event_timestamp(); | 795 return sender_->last_event_timestamp(); |
| 795 return 0; | 796 return 0; |
| 796 } | 797 } |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 } | 1761 } |
| 1761 | 1762 |
| 1762 void EventSender::TouchStart() { | 1763 void EventSender::TouchStart() { |
| 1763 SendCurrentTouchEvent(WebInputEvent::TouchStart, false); | 1764 SendCurrentTouchEvent(WebInputEvent::TouchStart, false); |
| 1764 } | 1765 } |
| 1765 | 1766 |
| 1766 void EventSender::TouchMove() { | 1767 void EventSender::TouchMove() { |
| 1767 SendCurrentTouchEvent(WebInputEvent::TouchMove, false); | 1768 SendCurrentTouchEvent(WebInputEvent::TouchMove, false); |
| 1768 } | 1769 } |
| 1769 | 1770 |
| 1770 void EventSender::TouchMoveCausingScrollIfUncanceled() { | |
| 1771 SendCurrentTouchEvent(WebInputEvent::TouchMove, true); | |
| 1772 } | |
| 1773 | |
| 1774 void EventSender::TouchCancel() { | 1771 void EventSender::TouchCancel() { |
| 1775 SendCurrentTouchEvent(WebInputEvent::TouchCancel, false); | 1772 SendCurrentTouchEvent(WebInputEvent::TouchCancel, false); |
| 1776 } | 1773 } |
| 1777 | 1774 |
| 1778 void EventSender::TouchEnd() { | 1775 void EventSender::TouchEnd() { |
| 1779 SendCurrentTouchEvent(WebInputEvent::TouchEnd, false); | 1776 SendCurrentTouchEvent(WebInputEvent::TouchEnd, false); |
| 1780 } | 1777 } |
| 1781 | 1778 |
| 1779 void EventSender::NotifyStartOfTouchScroll() { |
| 1780 WebTouchEvent event; |
| 1781 event.type = WebInputEvent::TouchScrollStarted; |
| 1782 HandleInputEventOnViewOrPopup(event); |
| 1783 } |
| 1784 |
| 1782 void EventSender::LeapForward(int milliseconds) { | 1785 void EventSender::LeapForward(int milliseconds) { |
| 1783 if (is_drag_mode_ && pressed_button_ == WebMouseEvent::ButtonLeft && | 1786 if (is_drag_mode_ && pressed_button_ == WebMouseEvent::ButtonLeft && |
| 1784 !replaying_saved_events_) { | 1787 !replaying_saved_events_) { |
| 1785 SavedEvent saved_event; | 1788 SavedEvent saved_event; |
| 1786 saved_event.type = SavedEvent::TYPE_LEAP_FORWARD; | 1789 saved_event.type = SavedEvent::TYPE_LEAP_FORWARD; |
| 1787 saved_event.milliseconds = milliseconds; | 1790 saved_event.milliseconds = milliseconds; |
| 1788 mouse_event_queue_.push_back(saved_event); | 1791 mouse_event_queue_.push_back(saved_event); |
| 1789 } else { | 1792 } else { |
| 1790 DoLeapForward(milliseconds); | 1793 DoLeapForward(milliseconds); |
| 1791 } | 1794 } |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2615 &end_event); | 2618 &end_event); |
| 2616 end_event.data.scrollEnd.deltaUnits = | 2619 end_event.data.scrollEnd.deltaUnits = |
| 2617 begin_event.data.scrollBegin.deltaHintUnits; | 2620 begin_event.data.scrollBegin.deltaHintUnits; |
| 2618 | 2621 |
| 2619 if (force_layout_on_events_) | 2622 if (force_layout_on_events_) |
| 2620 view_->updateAllLifecyclePhases(); | 2623 view_->updateAllLifecyclePhases(); |
| 2621 HandleInputEventOnViewOrPopup(end_event); | 2624 HandleInputEventOnViewOrPopup(end_event); |
| 2622 } | 2625 } |
| 2623 | 2626 |
| 2624 } // namespace test_runner | 2627 } // namespace test_runner |
| OLD | NEW |