| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 float velocity_x, | 503 float velocity_x, |
| 504 float velocity_y, | 504 float velocity_y, |
| 505 gin::Arguments* args); | 505 gin::Arguments* args); |
| 506 bool IsFlinging() const; | 506 bool IsFlinging() const; |
| 507 void GestureScrollFirstPoint(int x, int y); | 507 void GestureScrollFirstPoint(int x, int y); |
| 508 void TouchStart(); | 508 void TouchStart(); |
| 509 void TouchMove(); | 509 void TouchMove(); |
| 510 void TouchMoveCausingScrollIfUncanceled(); | 510 void TouchMoveCausingScrollIfUncanceled(); |
| 511 void TouchCancel(); | 511 void TouchCancel(); |
| 512 void TouchEnd(); | 512 void TouchEnd(); |
| 513 void NotifyStartOfTouchScroll(); |
| 513 void LeapForward(int milliseconds); | 514 void LeapForward(int milliseconds); |
| 514 double LastEventTimestamp(); | 515 double LastEventTimestamp(); |
| 515 void BeginDragWithFiles(const std::vector<std::string>& files); | 516 void BeginDragWithFiles(const std::vector<std::string>& files); |
| 516 void AddTouchPoint(double x, double y, gin::Arguments* args); | 517 void AddTouchPoint(double x, double y, gin::Arguments* args); |
| 517 void GestureScrollBegin(gin::Arguments* args); | 518 void GestureScrollBegin(gin::Arguments* args); |
| 518 void GestureScrollEnd(gin::Arguments* args); | 519 void GestureScrollEnd(gin::Arguments* args); |
| 519 void GestureScrollUpdate(gin::Arguments* args); | 520 void GestureScrollUpdate(gin::Arguments* args); |
| 520 void GesturePinchBegin(gin::Arguments* args); | 521 void GesturePinchBegin(gin::Arguments* args); |
| 521 void GesturePinchEnd(gin::Arguments* args); | 522 void GesturePinchEnd(gin::Arguments* args); |
| 522 void GesturePinchUpdate(gin::Arguments* args); | 523 void GesturePinchUpdate(gin::Arguments* args); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) | 625 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) |
| 625 .SetMethod("dumpFilenameBeingDragged", | 626 .SetMethod("dumpFilenameBeingDragged", |
| 626 &EventSenderBindings::DumpFilenameBeingDragged) | 627 &EventSenderBindings::DumpFilenameBeingDragged) |
| 627 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel) | 628 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel) |
| 628 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart) | 629 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart) |
| 629 .SetMethod("isFlinging", &EventSenderBindings::IsFlinging) | 630 .SetMethod("isFlinging", &EventSenderBindings::IsFlinging) |
| 630 .SetMethod("gestureScrollFirstPoint", | 631 .SetMethod("gestureScrollFirstPoint", |
| 631 &EventSenderBindings::GestureScrollFirstPoint) | 632 &EventSenderBindings::GestureScrollFirstPoint) |
| 632 .SetMethod("touchStart", &EventSenderBindings::TouchStart) | 633 .SetMethod("touchStart", &EventSenderBindings::TouchStart) |
| 633 .SetMethod("touchMove", &EventSenderBindings::TouchMove) | 634 .SetMethod("touchMove", &EventSenderBindings::TouchMove) |
| 634 .SetMethod("touchMoveCausingScrollIfUncanceled", | |
| 635 &EventSenderBindings::TouchMoveCausingScrollIfUncanceled) | |
| 636 .SetMethod("touchCancel", &EventSenderBindings::TouchCancel) | 635 .SetMethod("touchCancel", &EventSenderBindings::TouchCancel) |
| 637 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) | 636 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) |
| 637 .SetMethod("notifyStartOfTouchScroll", |
| 638 &EventSenderBindings::NotifyStartOfTouchScroll) |
| 638 .SetMethod("leapForward", &EventSenderBindings::LeapForward) | 639 .SetMethod("leapForward", &EventSenderBindings::LeapForward) |
| 639 .SetMethod("lastEventTimestamp", &EventSenderBindings::LastEventTimestamp) | 640 .SetMethod("lastEventTimestamp", &EventSenderBindings::LastEventTimestamp) |
| 640 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) | 641 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) |
| 641 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) | 642 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) |
| 642 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) | 643 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) |
| 643 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) | 644 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) |
| 644 .SetMethod("gestureScrollUpdate", | 645 .SetMethod("gestureScrollUpdate", |
| 645 &EventSenderBindings::GestureScrollUpdate) | 646 &EventSenderBindings::GestureScrollUpdate) |
| 646 .SetMethod("gesturePinchBegin", &EventSenderBindings::GesturePinchBegin) | 647 .SetMethod("gesturePinchBegin", &EventSenderBindings::GesturePinchBegin) |
| 647 .SetMethod("gesturePinchEnd", &EventSenderBindings::GesturePinchEnd) | 648 .SetMethod("gesturePinchEnd", &EventSenderBindings::GesturePinchEnd) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 void EventSenderBindings::TouchStart() { | 809 void EventSenderBindings::TouchStart() { |
| 809 if (sender_) | 810 if (sender_) |
| 810 sender_->TouchStart(); | 811 sender_->TouchStart(); |
| 811 } | 812 } |
| 812 | 813 |
| 813 void EventSenderBindings::TouchMove() { | 814 void EventSenderBindings::TouchMove() { |
| 814 if (sender_) | 815 if (sender_) |
| 815 sender_->TouchMove(); | 816 sender_->TouchMove(); |
| 816 } | 817 } |
| 817 | 818 |
| 818 void EventSenderBindings::TouchMoveCausingScrollIfUncanceled() { | |
| 819 if (sender_) | |
| 820 sender_->TouchMoveCausingScrollIfUncanceled(); | |
| 821 } | |
| 822 | |
| 823 void EventSenderBindings::TouchCancel() { | 819 void EventSenderBindings::TouchCancel() { |
| 824 if (sender_) | 820 if (sender_) |
| 825 sender_->TouchCancel(); | 821 sender_->TouchCancel(); |
| 826 } | 822 } |
| 827 | 823 |
| 828 void EventSenderBindings::TouchEnd() { | 824 void EventSenderBindings::TouchEnd() { |
| 829 if (sender_) | 825 if (sender_) |
| 830 sender_->TouchEnd(); | 826 sender_->TouchEnd(); |
| 831 } | 827 } |
| 832 | 828 |
| 829 void EventSenderBindings::NotifyStartOfTouchScroll() { |
| 830 if (sender_) |
| 831 sender_->NotifyStartOfTouchScroll(); |
| 832 } |
| 833 |
| 833 void EventSenderBindings::LeapForward(int milliseconds) { | 834 void EventSenderBindings::LeapForward(int milliseconds) { |
| 834 if (sender_) | 835 if (sender_) |
| 835 sender_->LeapForward(milliseconds); | 836 sender_->LeapForward(milliseconds); |
| 836 } | 837 } |
| 837 | 838 |
| 838 double EventSenderBindings::LastEventTimestamp() { | 839 double EventSenderBindings::LastEventTimestamp() { |
| 839 if (sender_) | 840 if (sender_) |
| 840 return sender_->last_event_timestamp(); | 841 return sender_->last_event_timestamp(); |
| 841 return 0; | 842 return 0; |
| 842 } | 843 } |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 } | 1807 } |
| 1807 | 1808 |
| 1808 void EventSender::TouchStart() { | 1809 void EventSender::TouchStart() { |
| 1809 SendCurrentTouchEvent(WebInputEvent::TouchStart, false); | 1810 SendCurrentTouchEvent(WebInputEvent::TouchStart, false); |
| 1810 } | 1811 } |
| 1811 | 1812 |
| 1812 void EventSender::TouchMove() { | 1813 void EventSender::TouchMove() { |
| 1813 SendCurrentTouchEvent(WebInputEvent::TouchMove, false); | 1814 SendCurrentTouchEvent(WebInputEvent::TouchMove, false); |
| 1814 } | 1815 } |
| 1815 | 1816 |
| 1816 void EventSender::TouchMoveCausingScrollIfUncanceled() { | |
| 1817 SendCurrentTouchEvent(WebInputEvent::TouchMove, true); | |
| 1818 } | |
| 1819 | |
| 1820 void EventSender::TouchCancel() { | 1817 void EventSender::TouchCancel() { |
| 1821 SendCurrentTouchEvent(WebInputEvent::TouchCancel, false); | 1818 SendCurrentTouchEvent(WebInputEvent::TouchCancel, false); |
| 1822 } | 1819 } |
| 1823 | 1820 |
| 1824 void EventSender::TouchEnd() { | 1821 void EventSender::TouchEnd() { |
| 1825 SendCurrentTouchEvent(WebInputEvent::TouchEnd, false); | 1822 SendCurrentTouchEvent(WebInputEvent::TouchEnd, false); |
| 1826 } | 1823 } |
| 1827 | 1824 |
| 1825 void EventSender::NotifyStartOfTouchScroll() { |
| 1826 WebTouchEvent event; |
| 1827 event.type = WebInputEvent::TouchScrollStarted; |
| 1828 HandleInputEventOnViewOrPopup(event); |
| 1829 } |
| 1830 |
| 1828 void EventSender::LeapForward(int milliseconds) { | 1831 void EventSender::LeapForward(int milliseconds) { |
| 1829 if (is_drag_mode_ && pressed_button_ == WebMouseEvent::ButtonLeft && | 1832 if (is_drag_mode_ && pressed_button_ == WebMouseEvent::ButtonLeft && |
| 1830 !replaying_saved_events_) { | 1833 !replaying_saved_events_) { |
| 1831 SavedEvent saved_event; | 1834 SavedEvent saved_event; |
| 1832 saved_event.type = SavedEvent::TYPE_LEAP_FORWARD; | 1835 saved_event.type = SavedEvent::TYPE_LEAP_FORWARD; |
| 1833 saved_event.milliseconds = milliseconds; | 1836 saved_event.milliseconds = milliseconds; |
| 1834 mouse_event_queue_.push_back(saved_event); | 1837 mouse_event_queue_.push_back(saved_event); |
| 1835 } else { | 1838 } else { |
| 1836 DoLeapForward(milliseconds); | 1839 DoLeapForward(milliseconds); |
| 1837 } | 1840 } |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2655 &end_event); | 2658 &end_event); |
| 2656 end_event.data.scrollEnd.deltaUnits = | 2659 end_event.data.scrollEnd.deltaUnits = |
| 2657 begin_event.data.scrollBegin.deltaHintUnits; | 2660 begin_event.data.scrollBegin.deltaHintUnits; |
| 2658 | 2661 |
| 2659 if (force_layout_on_events_) | 2662 if (force_layout_on_events_) |
| 2660 view_->updateAllLifecyclePhases(); | 2663 view_->updateAllLifecyclePhases(); |
| 2661 HandleInputEventOnViewOrPopup(end_event); | 2664 HandleInputEventOnViewOrPopup(end_event); |
| 2662 } | 2665 } |
| 2663 | 2666 |
| 2664 } // namespace test_runner | 2667 } // namespace test_runner |
| OLD | NEW |