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 "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "content/public/common/page_zoom.h" | 10 #include "content/public/common/page_zoom.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 void GestureScrollFirstPoint(int x, int y); | 350 void GestureScrollFirstPoint(int x, int y); |
351 void TouchStart(); | 351 void TouchStart(); |
352 void TouchMove(); | 352 void TouchMove(); |
353 void TouchCancel(); | 353 void TouchCancel(); |
354 void TouchEnd(); | 354 void TouchEnd(); |
355 void LeapForward(int milliseconds); | 355 void LeapForward(int milliseconds); |
356 void BeginDragWithFiles(const std::vector<std::string>& files); | 356 void BeginDragWithFiles(const std::vector<std::string>& files); |
357 void AddTouchPoint(gin::Arguments* args); | 357 void AddTouchPoint(gin::Arguments* args); |
358 void MouseDragBegin(); | 358 void MouseDragBegin(); |
359 void MouseDragEnd(); | 359 void MouseDragEnd(); |
360 void MouseMomentumBegin(); | |
361 void GestureScrollBegin(gin::Arguments* args); | 360 void GestureScrollBegin(gin::Arguments* args); |
362 void GestureScrollEnd(gin::Arguments* args); | 361 void GestureScrollEnd(gin::Arguments* args); |
363 void GestureScrollUpdate(gin::Arguments* args); | 362 void GestureScrollUpdate(gin::Arguments* args); |
364 void GestureScrollUpdateWithoutPropagation(gin::Arguments* args); | 363 void GestureScrollUpdateWithoutPropagation(gin::Arguments* args); |
365 void GestureTap(gin::Arguments* args); | 364 void GestureTap(gin::Arguments* args); |
366 void GestureTapDown(gin::Arguments* args); | 365 void GestureTapDown(gin::Arguments* args); |
367 void GestureShowPress(gin::Arguments* args); | 366 void GestureShowPress(gin::Arguments* args); |
368 void GestureTapCancel(gin::Arguments* args); | 367 void GestureTapCancel(gin::Arguments* args); |
369 void GestureLongPress(gin::Arguments* args); | 368 void GestureLongPress(gin::Arguments* args); |
370 void GestureLongTap(gin::Arguments* args); | 369 void GestureLongTap(gin::Arguments* args); |
371 void GestureTwoFingerTap(gin::Arguments* args); | 370 void GestureTwoFingerTap(gin::Arguments* args); |
372 void ContinuousMouseScrollBy(gin::Arguments* args); | 371 void ContinuousMouseScrollBy(gin::Arguments* args); |
373 void MouseMoveTo(gin::Arguments* args); | 372 void MouseMoveTo(gin::Arguments* args); |
373 void TrackpadScrollBegin(gin::Arguments* args); | |
jochen (gone - plz use gerrit)
2014/05/15 15:30:45
begin and end don't seem to use args?
erikchen
2014/05/15 16:23:04
right you are. I've removed the parameter from the
| |
374 void TrackpadScroll(gin::Arguments* args); | |
375 void TrackpadScrollEnd(gin::Arguments* args); | |
374 void MouseScrollBy(gin::Arguments* args); | 376 void MouseScrollBy(gin::Arguments* args); |
377 // TODO(erikchen): Remove MouseMomentumBegin once CL 282743002 has landed. | |
378 void MouseMomentumBegin(); | |
379 void MouseMomentumBegin2(gin::Arguments* args); | |
375 void MouseMomentumScrollBy(gin::Arguments* args); | 380 void MouseMomentumScrollBy(gin::Arguments* args); |
376 void MouseMomentumEnd(); | 381 void MouseMomentumEnd(); |
377 void ScheduleAsynchronousClick(gin::Arguments* args); | 382 void ScheduleAsynchronousClick(gin::Arguments* args); |
378 void ScheduleAsynchronousKeyDown(gin::Arguments* args); | 383 void ScheduleAsynchronousKeyDown(gin::Arguments* args); |
379 void MouseDown(gin::Arguments* args); | 384 void MouseDown(gin::Arguments* args); |
380 void MouseUp(gin::Arguments* args); | 385 void MouseUp(gin::Arguments* args); |
381 void KeyDown(gin::Arguments* args); | 386 void KeyDown(gin::Arguments* args); |
382 | 387 |
383 // Binding properties: | 388 // Binding properties: |
384 bool ForceLayoutOnEvents() const; | 389 bool ForceLayoutOnEvents() const; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 &EventSenderBindings::GestureScrollFirstPoint) | 478 &EventSenderBindings::GestureScrollFirstPoint) |
474 .SetMethod("touchStart", &EventSenderBindings::TouchStart) | 479 .SetMethod("touchStart", &EventSenderBindings::TouchStart) |
475 .SetMethod("touchMove", &EventSenderBindings::TouchMove) | 480 .SetMethod("touchMove", &EventSenderBindings::TouchMove) |
476 .SetMethod("touchCancel", &EventSenderBindings::TouchCancel) | 481 .SetMethod("touchCancel", &EventSenderBindings::TouchCancel) |
477 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) | 482 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) |
478 .SetMethod("leapForward", &EventSenderBindings::LeapForward) | 483 .SetMethod("leapForward", &EventSenderBindings::LeapForward) |
479 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) | 484 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) |
480 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) | 485 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) |
481 .SetMethod("mouseDragBegin", &EventSenderBindings::MouseDragBegin) | 486 .SetMethod("mouseDragBegin", &EventSenderBindings::MouseDragBegin) |
482 .SetMethod("mouseDragEnd", &EventSenderBindings::MouseDragEnd) | 487 .SetMethod("mouseDragEnd", &EventSenderBindings::MouseDragEnd) |
483 .SetMethod("mouseMomentumBegin", &EventSenderBindings::MouseMomentumBegin) | |
484 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) | 488 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) |
485 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) | 489 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) |
486 .SetMethod("gestureScrollUpdate", | 490 .SetMethod("gestureScrollUpdate", |
487 &EventSenderBindings::GestureScrollUpdate) | 491 &EventSenderBindings::GestureScrollUpdate) |
488 .SetMethod("gestureScrollUpdateWithoutPropagation", | 492 .SetMethod("gestureScrollUpdateWithoutPropagation", |
489 &EventSenderBindings::GestureScrollUpdateWithoutPropagation) | 493 &EventSenderBindings::GestureScrollUpdateWithoutPropagation) |
490 .SetMethod("gestureTap", &EventSenderBindings::GestureTap) | 494 .SetMethod("gestureTap", &EventSenderBindings::GestureTap) |
491 .SetMethod("gestureTapDown", &EventSenderBindings::GestureTapDown) | 495 .SetMethod("gestureTapDown", &EventSenderBindings::GestureTapDown) |
492 .SetMethod("gestureShowPress", &EventSenderBindings::GestureShowPress) | 496 .SetMethod("gestureShowPress", &EventSenderBindings::GestureShowPress) |
493 .SetMethod("gestureTapCancel", &EventSenderBindings::GestureTapCancel) | 497 .SetMethod("gestureTapCancel", &EventSenderBindings::GestureTapCancel) |
494 .SetMethod("gestureLongPress", &EventSenderBindings::GestureLongPress) | 498 .SetMethod("gestureLongPress", &EventSenderBindings::GestureLongPress) |
495 .SetMethod("gestureLongTap", &EventSenderBindings::GestureLongTap) | 499 .SetMethod("gestureLongTap", &EventSenderBindings::GestureLongTap) |
496 .SetMethod("gestureTwoFingerTap", | 500 .SetMethod("gestureTwoFingerTap", |
497 &EventSenderBindings::GestureTwoFingerTap) | 501 &EventSenderBindings::GestureTwoFingerTap) |
498 .SetMethod("continuousMouseScrollBy", | 502 .SetMethod("continuousMouseScrollBy", |
499 &EventSenderBindings::ContinuousMouseScrollBy) | 503 &EventSenderBindings::ContinuousMouseScrollBy) |
500 .SetMethod("keyDown", &EventSenderBindings::KeyDown) | 504 .SetMethod("keyDown", &EventSenderBindings::KeyDown) |
501 .SetMethod("mouseDown", &EventSenderBindings::MouseDown) | 505 .SetMethod("mouseDown", &EventSenderBindings::MouseDown) |
502 .SetMethod("mouseMoveTo", &EventSenderBindings::MouseMoveTo) | 506 .SetMethod("mouseMoveTo", &EventSenderBindings::MouseMoveTo) |
507 .SetMethod("trackpadScrollBegin", | |
508 &EventSenderBindings::TrackpadScrollBegin) | |
509 .SetMethod("trackpadScroll", &EventSenderBindings::TrackpadScroll) | |
510 .SetMethod("trackpadScrollEnd", &EventSenderBindings::TrackpadScrollEnd) | |
503 .SetMethod("mouseScrollBy", &EventSenderBindings::MouseScrollBy) | 511 .SetMethod("mouseScrollBy", &EventSenderBindings::MouseScrollBy) |
504 .SetMethod("mouseUp", &EventSenderBindings::MouseUp) | 512 .SetMethod("mouseUp", &EventSenderBindings::MouseUp) |
513 .SetMethod("mouseMomentumBegin", &EventSenderBindings::MouseMomentumBegin) | |
514 .SetMethod("mouseMomentumBegin2", | |
515 &EventSenderBindings::MouseMomentumBegin2) | |
505 .SetMethod("mouseMomentumScrollBy", | 516 .SetMethod("mouseMomentumScrollBy", |
506 &EventSenderBindings::MouseMomentumScrollBy) | 517 &EventSenderBindings::MouseMomentumScrollBy) |
507 .SetMethod("mouseMomentumEnd", &EventSenderBindings::MouseMomentumEnd) | 518 .SetMethod("mouseMomentumEnd", &EventSenderBindings::MouseMomentumEnd) |
508 .SetMethod("scheduleAsynchronousClick", | 519 .SetMethod("scheduleAsynchronousClick", |
509 &EventSenderBindings::ScheduleAsynchronousClick) | 520 &EventSenderBindings::ScheduleAsynchronousClick) |
510 .SetMethod("scheduleAsynchronousKeyDown", | 521 .SetMethod("scheduleAsynchronousKeyDown", |
511 &EventSenderBindings::ScheduleAsynchronousKeyDown) | 522 &EventSenderBindings::ScheduleAsynchronousKeyDown) |
512 .SetProperty("forceLayoutOnEvents", | 523 .SetProperty("forceLayoutOnEvents", |
513 &EventSenderBindings::ForceLayoutOnEvents, | 524 &EventSenderBindings::ForceLayoutOnEvents, |
514 &EventSenderBindings::SetForceLayoutOnEvents) | 525 &EventSenderBindings::SetForceLayoutOnEvents) |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
703 void EventSenderBindings::MouseDragBegin() { | 714 void EventSenderBindings::MouseDragBegin() { |
704 if (sender_) | 715 if (sender_) |
705 sender_->MouseDragBegin(); | 716 sender_->MouseDragBegin(); |
706 } | 717 } |
707 | 718 |
708 void EventSenderBindings::MouseDragEnd() { | 719 void EventSenderBindings::MouseDragEnd() { |
709 if (sender_) | 720 if (sender_) |
710 sender_->MouseDragEnd(); | 721 sender_->MouseDragEnd(); |
711 } | 722 } |
712 | 723 |
713 void EventSenderBindings::MouseMomentumBegin() { | |
714 if (sender_) | |
715 sender_->MouseMomentumBegin(); | |
716 } | |
717 | |
718 void EventSenderBindings::GestureScrollBegin(gin::Arguments* args) { | 724 void EventSenderBindings::GestureScrollBegin(gin::Arguments* args) { |
719 if (sender_) | 725 if (sender_) |
720 sender_->GestureScrollBegin(args); | 726 sender_->GestureScrollBegin(args); |
721 } | 727 } |
722 | 728 |
723 void EventSenderBindings::GestureScrollEnd(gin::Arguments* args) { | 729 void EventSenderBindings::GestureScrollEnd(gin::Arguments* args) { |
724 if (sender_) | 730 if (sender_) |
725 sender_->GestureScrollEnd(args); | 731 sender_->GestureScrollEnd(args); |
726 } | 732 } |
727 | 733 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
774 void EventSenderBindings::ContinuousMouseScrollBy(gin::Arguments* args) { | 780 void EventSenderBindings::ContinuousMouseScrollBy(gin::Arguments* args) { |
775 if (sender_) | 781 if (sender_) |
776 sender_->ContinuousMouseScrollBy(args); | 782 sender_->ContinuousMouseScrollBy(args); |
777 } | 783 } |
778 | 784 |
779 void EventSenderBindings::MouseMoveTo(gin::Arguments* args) { | 785 void EventSenderBindings::MouseMoveTo(gin::Arguments* args) { |
780 if (sender_) | 786 if (sender_) |
781 sender_->MouseMoveTo(args); | 787 sender_->MouseMoveTo(args); |
782 } | 788 } |
783 | 789 |
790 void EventSenderBindings::TrackpadScrollBegin(gin::Arguments* args) { | |
791 if (sender_) | |
792 sender_->TrackpadScrollBegin(args); | |
793 } | |
794 | |
795 void EventSenderBindings::TrackpadScroll(gin::Arguments* args) { | |
796 if (sender_) | |
797 sender_->TrackpadScroll(args); | |
798 } | |
799 | |
800 void EventSenderBindings::TrackpadScrollEnd(gin::Arguments* args) { | |
801 if (sender_) | |
802 sender_->TrackpadScrollEnd(args); | |
803 } | |
804 | |
784 void EventSenderBindings::MouseScrollBy(gin::Arguments* args) { | 805 void EventSenderBindings::MouseScrollBy(gin::Arguments* args) { |
785 if (sender_) | 806 if (sender_) |
786 sender_->MouseScrollBy(args); | 807 sender_->MouseScrollBy(args); |
787 } | 808 } |
788 | 809 |
810 void EventSenderBindings::MouseMomentumBegin() { | |
811 if (sender_) | |
812 sender_->MouseMomentumBegin(); | |
813 } | |
814 | |
815 void EventSenderBindings::MouseMomentumBegin2(gin::Arguments* args) { | |
816 if (sender_) | |
817 sender_->MouseMomentumBegin2(args); | |
818 } | |
819 | |
789 void EventSenderBindings::MouseMomentumScrollBy(gin::Arguments* args) { | 820 void EventSenderBindings::MouseMomentumScrollBy(gin::Arguments* args) { |
790 if (sender_) | 821 if (sender_) |
791 sender_->MouseMomentumScrollBy(args); | 822 sender_->MouseMomentumScrollBy(args); |
792 } | 823 } |
793 | 824 |
794 void EventSenderBindings::MouseMomentumEnd() { | 825 void EventSenderBindings::MouseMomentumEnd() { |
795 if (sender_) | 826 if (sender_) |
796 sender_->MouseMomentumEnd(); | 827 sender_->MouseMomentumEnd(); |
797 } | 828 } |
798 | 829 |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1637 last_mouse_pos_, | 1668 last_mouse_pos_, |
1638 GetCurrentEventTimeSec(), | 1669 GetCurrentEventTimeSec(), |
1639 click_count_, | 1670 click_count_, |
1640 0, | 1671 0, |
1641 &event); | 1672 &event); |
1642 event.phase = WebMouseWheelEvent::PhaseEnded; | 1673 event.phase = WebMouseWheelEvent::PhaseEnded; |
1643 event.hasPreciseScrollingDeltas = true; | 1674 event.hasPreciseScrollingDeltas = true; |
1644 view_->handleInputEvent(event); | 1675 view_->handleInputEvent(event); |
1645 } | 1676 } |
1646 | 1677 |
1647 void EventSender::MouseMomentumBegin() { | |
1648 WebMouseWheelEvent event; | |
1649 InitMouseEvent(WebInputEvent::MouseWheel, | |
1650 WebMouseEvent::ButtonNone, | |
1651 last_mouse_pos_, | |
1652 GetCurrentEventTimeSec(), | |
1653 click_count_, | |
1654 0, | |
1655 &event); | |
1656 event.momentumPhase = WebMouseWheelEvent::PhaseBegan; | |
1657 event.hasPreciseScrollingDeltas = true; | |
1658 view_->handleInputEvent(event); | |
1659 } | |
1660 | |
1661 void EventSender::GestureScrollBegin(gin::Arguments* args) { | 1678 void EventSender::GestureScrollBegin(gin::Arguments* args) { |
1662 GestureEvent(WebInputEvent::GestureScrollBegin, args); | 1679 GestureEvent(WebInputEvent::GestureScrollBegin, args); |
1663 } | 1680 } |
1664 | 1681 |
1665 void EventSender::GestureScrollEnd(gin::Arguments* args) { | 1682 void EventSender::GestureScrollEnd(gin::Arguments* args) { |
1666 GestureEvent(WebInputEvent::GestureScrollEnd, args); | 1683 GestureEvent(WebInputEvent::GestureScrollEnd, args); |
1667 } | 1684 } |
1668 | 1685 |
1669 void EventSender::GestureScrollUpdate(gin::Arguments* args) { | 1686 void EventSender::GestureScrollUpdate(gin::Arguments* args) { |
1670 GestureEvent(WebInputEvent::GestureScrollUpdate, args); | 1687 GestureEvent(WebInputEvent::GestureScrollUpdate, args); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1735 pressed_button_, | 1752 pressed_button_, |
1736 mouse_pos, | 1753 mouse_pos, |
1737 GetCurrentEventTimeSec(), | 1754 GetCurrentEventTimeSec(), |
1738 click_count_, | 1755 click_count_, |
1739 modifiers, | 1756 modifiers, |
1740 &event); | 1757 &event); |
1741 DoMouseMove(event); | 1758 DoMouseMove(event); |
1742 } | 1759 } |
1743 } | 1760 } |
1744 | 1761 |
1762 void EventSender::TrackpadScrollBegin(gin::Arguments* args) { | |
1763 WebMouseWheelEvent event; | |
1764 InitMouseEvent(WebInputEvent::MouseWheel, | |
1765 WebMouseEvent::ButtonNone, | |
1766 last_mouse_pos_, | |
1767 GetCurrentEventTimeSec(), | |
1768 click_count_, | |
1769 0, | |
1770 &event); | |
1771 event.phase = blink::WebMouseWheelEvent::PhaseBegan; | |
1772 event.hasPreciseScrollingDeltas = true; | |
1773 view_->handleInputEvent(event); | |
1774 } | |
1775 | |
1776 void EventSender::TrackpadScroll(gin::Arguments* args) { | |
1777 WebMouseWheelEvent event; | |
1778 InitMouseWheelEvent(args, true, &event); | |
1779 event.phase = blink::WebMouseWheelEvent::PhaseChanged; | |
1780 event.hasPreciseScrollingDeltas = true; | |
1781 view_->handleInputEvent(event); | |
1782 } | |
1783 | |
1784 void EventSender::TrackpadScrollEnd(gin::Arguments* args) { | |
1785 WebMouseWheelEvent event; | |
1786 InitMouseEvent(WebInputEvent::MouseWheel, | |
1787 WebMouseEvent::ButtonNone, | |
1788 last_mouse_pos_, | |
1789 GetCurrentEventTimeSec(), | |
1790 click_count_, | |
1791 0, | |
1792 &event); | |
1793 event.phase = WebMouseWheelEvent::PhaseEnded; | |
1794 event.hasPreciseScrollingDeltas = true; | |
1795 view_->handleInputEvent(event); | |
1796 } | |
1797 | |
1745 void EventSender::MouseScrollBy(gin::Arguments* args) { | 1798 void EventSender::MouseScrollBy(gin::Arguments* args) { |
1746 WebMouseWheelEvent event; | 1799 WebMouseWheelEvent event; |
1747 InitMouseWheelEvent(args, false, &event); | 1800 InitMouseWheelEvent(args, false, &event); |
1748 view_->handleInputEvent(event); | 1801 view_->handleInputEvent(event); |
1749 } | 1802 } |
1750 | 1803 |
1804 void EventSender::MouseMomentumBegin() { | |
1805 WebMouseWheelEvent event; | |
1806 InitMouseEvent(WebInputEvent::MouseWheel, | |
1807 WebMouseEvent::ButtonNone, | |
1808 last_mouse_pos_, | |
1809 GetCurrentEventTimeSec(), | |
1810 click_count_, | |
1811 0, | |
1812 &event); | |
1813 event.momentumPhase = WebMouseWheelEvent::PhaseBegan; | |
1814 event.hasPreciseScrollingDeltas = true; | |
1815 view_->handleInputEvent(event); | |
1816 } | |
1817 | |
1818 void EventSender::MouseMomentumBegin2(gin::Arguments* args) { | |
1819 WebMouseWheelEvent event; | |
1820 InitMouseWheelEvent(args, true, &event); | |
1821 event.momentumPhase = WebMouseWheelEvent::PhaseBegan; | |
1822 event.hasPreciseScrollingDeltas = true; | |
1823 view_->handleInputEvent(event); | |
1824 } | |
1825 | |
1751 void EventSender::MouseMomentumScrollBy(gin::Arguments* args) { | 1826 void EventSender::MouseMomentumScrollBy(gin::Arguments* args) { |
1752 WebMouseWheelEvent event; | 1827 WebMouseWheelEvent event; |
1753 InitMouseWheelEvent(args, true, &event); | 1828 InitMouseWheelEvent(args, true, &event); |
1754 event.momentumPhase = WebMouseWheelEvent::PhaseChanged; | 1829 event.momentumPhase = WebMouseWheelEvent::PhaseChanged; |
1755 event.hasPreciseScrollingDeltas = true; | 1830 event.hasPreciseScrollingDeltas = true; |
1756 view_->handleInputEvent(event); | 1831 view_->handleInputEvent(event); |
1757 } | 1832 } |
1758 | 1833 |
1759 void EventSender::MouseMomentumEnd() { | 1834 void EventSender::MouseMomentumEnd() { |
1760 WebMouseWheelEvent event; | 1835 WebMouseWheelEvent event; |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2166 } | 2241 } |
2167 default: | 2242 default: |
2168 NOTREACHED(); | 2243 NOTREACHED(); |
2169 } | 2244 } |
2170 } | 2245 } |
2171 | 2246 |
2172 replaying_saved_events_ = false; | 2247 replaying_saved_events_ = false; |
2173 } | 2248 } |
2174 | 2249 |
2175 } // namespace content | 2250 } // namespace content |
OLD | NEW |