| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 float velocity_x, | 516 float velocity_x, |
| 517 float velocity_y, | 517 float velocity_y, |
| 518 gin::Arguments* args); | 518 gin::Arguments* args); |
| 519 bool IsFlinging() const; | 519 bool IsFlinging() const; |
| 520 void GestureScrollFirstPoint(int x, int y); | 520 void GestureScrollFirstPoint(int x, int y); |
| 521 void TouchStart(); | 521 void TouchStart(); |
| 522 void TouchMove(); | 522 void TouchMove(); |
| 523 void TouchMoveCausingScrollIfUncanceled(); | 523 void TouchMoveCausingScrollIfUncanceled(); |
| 524 void TouchCancel(); | 524 void TouchCancel(); |
| 525 void TouchEnd(); | 525 void TouchEnd(); |
| 526 void NotifyStartOfTouchScroll(); |
| 526 void LeapForward(int milliseconds); | 527 void LeapForward(int milliseconds); |
| 527 double LastEventTimestamp(); | 528 double LastEventTimestamp(); |
| 528 void BeginDragWithFiles(const std::vector<std::string>& files); | 529 void BeginDragWithFiles(const std::vector<std::string>& files); |
| 529 void AddTouchPoint(double x, double y, gin::Arguments* args); | 530 void AddTouchPoint(double x, double y, gin::Arguments* args); |
| 530 void GestureScrollBegin(gin::Arguments* args); | 531 void GestureScrollBegin(gin::Arguments* args); |
| 531 void GestureScrollEnd(gin::Arguments* args); | 532 void GestureScrollEnd(gin::Arguments* args); |
| 532 void GestureScrollUpdate(gin::Arguments* args); | 533 void GestureScrollUpdate(gin::Arguments* args); |
| 533 void GesturePinchBegin(gin::Arguments* args); | 534 void GesturePinchBegin(gin::Arguments* args); |
| 534 void GesturePinchEnd(gin::Arguments* args); | 535 void GesturePinchEnd(gin::Arguments* args); |
| 535 void GesturePinchUpdate(gin::Arguments* args); | 536 void GesturePinchUpdate(gin::Arguments* args); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) | 638 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) |
| 638 .SetMethod("dumpFilenameBeingDragged", | 639 .SetMethod("dumpFilenameBeingDragged", |
| 639 &EventSenderBindings::DumpFilenameBeingDragged) | 640 &EventSenderBindings::DumpFilenameBeingDragged) |
| 640 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel) | 641 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel) |
| 641 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart) | 642 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart) |
| 642 .SetMethod("isFlinging", &EventSenderBindings::IsFlinging) | 643 .SetMethod("isFlinging", &EventSenderBindings::IsFlinging) |
| 643 .SetMethod("gestureScrollFirstPoint", | 644 .SetMethod("gestureScrollFirstPoint", |
| 644 &EventSenderBindings::GestureScrollFirstPoint) | 645 &EventSenderBindings::GestureScrollFirstPoint) |
| 645 .SetMethod("touchStart", &EventSenderBindings::TouchStart) | 646 .SetMethod("touchStart", &EventSenderBindings::TouchStart) |
| 646 .SetMethod("touchMove", &EventSenderBindings::TouchMove) | 647 .SetMethod("touchMove", &EventSenderBindings::TouchMove) |
| 647 .SetMethod("touchMoveCausingScrollIfUncanceled", | |
| 648 &EventSenderBindings::TouchMoveCausingScrollIfUncanceled) | |
| 649 .SetMethod("touchCancel", &EventSenderBindings::TouchCancel) | 648 .SetMethod("touchCancel", &EventSenderBindings::TouchCancel) |
| 650 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) | 649 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) |
| 650 .SetMethod("notifyStartOfTouchScroll", |
| 651 &EventSenderBindings::NotifyStartOfTouchScroll) |
| 651 .SetMethod("leapForward", &EventSenderBindings::LeapForward) | 652 .SetMethod("leapForward", &EventSenderBindings::LeapForward) |
| 652 .SetMethod("lastEventTimestamp", &EventSenderBindings::LastEventTimestamp) | 653 .SetMethod("lastEventTimestamp", &EventSenderBindings::LastEventTimestamp) |
| 653 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) | 654 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) |
| 654 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) | 655 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) |
| 655 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) | 656 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) |
| 656 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) | 657 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) |
| 657 .SetMethod("gestureScrollUpdate", | 658 .SetMethod("gestureScrollUpdate", |
| 658 &EventSenderBindings::GestureScrollUpdate) | 659 &EventSenderBindings::GestureScrollUpdate) |
| 659 .SetMethod("gesturePinchBegin", &EventSenderBindings::GesturePinchBegin) | 660 .SetMethod("gesturePinchBegin", &EventSenderBindings::GesturePinchBegin) |
| 660 .SetMethod("gesturePinchEnd", &EventSenderBindings::GesturePinchEnd) | 661 .SetMethod("gesturePinchEnd", &EventSenderBindings::GesturePinchEnd) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 void EventSenderBindings::TouchStart() { | 822 void EventSenderBindings::TouchStart() { |
| 822 if (sender_) | 823 if (sender_) |
| 823 sender_->TouchStart(); | 824 sender_->TouchStart(); |
| 824 } | 825 } |
| 825 | 826 |
| 826 void EventSenderBindings::TouchMove() { | 827 void EventSenderBindings::TouchMove() { |
| 827 if (sender_) | 828 if (sender_) |
| 828 sender_->TouchMove(); | 829 sender_->TouchMove(); |
| 829 } | 830 } |
| 830 | 831 |
| 831 void EventSenderBindings::TouchMoveCausingScrollIfUncanceled() { | |
| 832 if (sender_) | |
| 833 sender_->TouchMoveCausingScrollIfUncanceled(); | |
| 834 } | |
| 835 | |
| 836 void EventSenderBindings::TouchCancel() { | 832 void EventSenderBindings::TouchCancel() { |
| 837 if (sender_) | 833 if (sender_) |
| 838 sender_->TouchCancel(); | 834 sender_->TouchCancel(); |
| 839 } | 835 } |
| 840 | 836 |
| 841 void EventSenderBindings::TouchEnd() { | 837 void EventSenderBindings::TouchEnd() { |
| 842 if (sender_) | 838 if (sender_) |
| 843 sender_->TouchEnd(); | 839 sender_->TouchEnd(); |
| 844 } | 840 } |
| 845 | 841 |
| 842 void EventSenderBindings::NotifyStartOfTouchScroll() { |
| 843 if (sender_) |
| 844 sender_->NotifyStartOfTouchScroll(); |
| 845 } |
| 846 |
| 846 void EventSenderBindings::LeapForward(int milliseconds) { | 847 void EventSenderBindings::LeapForward(int milliseconds) { |
| 847 if (sender_) | 848 if (sender_) |
| 848 sender_->LeapForward(milliseconds); | 849 sender_->LeapForward(milliseconds); |
| 849 } | 850 } |
| 850 | 851 |
| 851 double EventSenderBindings::LastEventTimestamp() { | 852 double EventSenderBindings::LastEventTimestamp() { |
| 852 if (sender_) | 853 if (sender_) |
| 853 return sender_->last_event_timestamp(); | 854 return sender_->last_event_timestamp(); |
| 854 return 0; | 855 return 0; |
| 855 } | 856 } |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 } | 1885 } |
| 1885 | 1886 |
| 1886 void EventSender::TouchStart() { | 1887 void EventSender::TouchStart() { |
| 1887 SendCurrentTouchEvent(WebInputEvent::TouchStart, false); | 1888 SendCurrentTouchEvent(WebInputEvent::TouchStart, false); |
| 1888 } | 1889 } |
| 1889 | 1890 |
| 1890 void EventSender::TouchMove() { | 1891 void EventSender::TouchMove() { |
| 1891 SendCurrentTouchEvent(WebInputEvent::TouchMove, false); | 1892 SendCurrentTouchEvent(WebInputEvent::TouchMove, false); |
| 1892 } | 1893 } |
| 1893 | 1894 |
| 1894 void EventSender::TouchMoveCausingScrollIfUncanceled() { | |
| 1895 SendCurrentTouchEvent(WebInputEvent::TouchMove, true); | |
| 1896 } | |
| 1897 | |
| 1898 void EventSender::TouchCancel() { | 1895 void EventSender::TouchCancel() { |
| 1899 SendCurrentTouchEvent(WebInputEvent::TouchCancel, false); | 1896 SendCurrentTouchEvent(WebInputEvent::TouchCancel, false); |
| 1900 } | 1897 } |
| 1901 | 1898 |
| 1902 void EventSender::TouchEnd() { | 1899 void EventSender::TouchEnd() { |
| 1903 SendCurrentTouchEvent(WebInputEvent::TouchEnd, false); | 1900 SendCurrentTouchEvent(WebInputEvent::TouchEnd, false); |
| 1904 } | 1901 } |
| 1905 | 1902 |
| 1903 void EventSender::NotifyStartOfTouchScroll() { |
| 1904 WebTouchEvent event; |
| 1905 event.type = WebInputEvent::TouchScrollStarted; |
| 1906 HandleInputEventOnViewOrPopup(event); |
| 1907 } |
| 1908 |
| 1906 void EventSender::LeapForward(int milliseconds) { | 1909 void EventSender::LeapForward(int milliseconds) { |
| 1907 if (is_drag_mode_ && | 1910 if (is_drag_mode_ && |
| 1908 current_pointer_state_[kMousePointerId].pressed_button_ == | 1911 current_pointer_state_[kMousePointerId].pressed_button_ == |
| 1909 WebMouseEvent::ButtonLeft && | 1912 WebMouseEvent::ButtonLeft && |
| 1910 !replaying_saved_events_) { | 1913 !replaying_saved_events_) { |
| 1911 SavedEvent saved_event; | 1914 SavedEvent saved_event; |
| 1912 saved_event.type = SavedEvent::TYPE_LEAP_FORWARD; | 1915 saved_event.type = SavedEvent::TYPE_LEAP_FORWARD; |
| 1913 saved_event.milliseconds = milliseconds; | 1916 saved_event.milliseconds = milliseconds; |
| 1914 mouse_event_queue_.push_back(saved_event); | 1917 mouse_event_queue_.push_back(saved_event); |
| 1915 } else { | 1918 } else { |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 &end_event); | 2761 &end_event); |
| 2759 end_event.data.scrollEnd.deltaUnits = | 2762 end_event.data.scrollEnd.deltaUnits = |
| 2760 begin_event.data.scrollBegin.deltaHintUnits; | 2763 begin_event.data.scrollBegin.deltaHintUnits; |
| 2761 | 2764 |
| 2762 if (force_layout_on_events_) | 2765 if (force_layout_on_events_) |
| 2763 view_->updateAllLifecyclePhases(); | 2766 view_->updateAllLifecyclePhases(); |
| 2764 HandleInputEventOnViewOrPopup(end_event); | 2767 HandleInputEventOnViewOrPopup(end_event); |
| 2765 } | 2768 } |
| 2766 | 2769 |
| 2767 } // namespace test_runner | 2770 } // namespace test_runner |
| OLD | NEW |