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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 void TouchCancel(); | 389 void TouchCancel(); |
390 void TouchEnd(); | 390 void TouchEnd(); |
391 void LeapForward(int milliseconds); | 391 void LeapForward(int milliseconds); |
392 void BeginDragWithFiles(const std::vector<std::string>& files); | 392 void BeginDragWithFiles(const std::vector<std::string>& files); |
393 void AddTouchPoint(gin::Arguments* args); | 393 void AddTouchPoint(gin::Arguments* args); |
394 void MouseDragBegin(); | 394 void MouseDragBegin(); |
395 void MouseDragEnd(); | 395 void MouseDragEnd(); |
396 void GestureScrollBegin(gin::Arguments* args); | 396 void GestureScrollBegin(gin::Arguments* args); |
397 void GestureScrollEnd(gin::Arguments* args); | 397 void GestureScrollEnd(gin::Arguments* args); |
398 void GestureScrollUpdate(gin::Arguments* args); | 398 void GestureScrollUpdate(gin::Arguments* args); |
399 void GesturePinchBegin(gin::Arguments* args); | |
400 void GesturePinchEnd(gin::Arguments* args); | |
401 void GesturePinchUpdate(gin::Arguments* args); | |
399 void GestureTap(gin::Arguments* args); | 402 void GestureTap(gin::Arguments* args); |
400 void GestureTapDown(gin::Arguments* args); | 403 void GestureTapDown(gin::Arguments* args); |
401 void GestureShowPress(gin::Arguments* args); | 404 void GestureShowPress(gin::Arguments* args); |
402 void GestureTapCancel(gin::Arguments* args); | 405 void GestureTapCancel(gin::Arguments* args); |
403 void GestureLongPress(gin::Arguments* args); | 406 void GestureLongPress(gin::Arguments* args); |
404 void GestureLongTap(gin::Arguments* args); | 407 void GestureLongTap(gin::Arguments* args); |
405 void GestureTwoFingerTap(gin::Arguments* args); | 408 void GestureTwoFingerTap(gin::Arguments* args); |
406 void ContinuousMouseScrollBy(gin::Arguments* args); | 409 void ContinuousMouseScrollBy(gin::Arguments* args); |
407 void MouseMoveTo(gin::Arguments* args); | 410 void MouseMoveTo(gin::Arguments* args); |
408 void TrackpadScrollBegin(); | 411 void TrackpadScrollBegin(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
519 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) | 522 .SetMethod("touchEnd", &EventSenderBindings::TouchEnd) |
520 .SetMethod("leapForward", &EventSenderBindings::LeapForward) | 523 .SetMethod("leapForward", &EventSenderBindings::LeapForward) |
521 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) | 524 .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles) |
522 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) | 525 .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint) |
523 .SetMethod("mouseDragBegin", &EventSenderBindings::MouseDragBegin) | 526 .SetMethod("mouseDragBegin", &EventSenderBindings::MouseDragBegin) |
524 .SetMethod("mouseDragEnd", &EventSenderBindings::MouseDragEnd) | 527 .SetMethod("mouseDragEnd", &EventSenderBindings::MouseDragEnd) |
525 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) | 528 .SetMethod("gestureScrollBegin", &EventSenderBindings::GestureScrollBegin) |
526 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) | 529 .SetMethod("gestureScrollEnd", &EventSenderBindings::GestureScrollEnd) |
527 .SetMethod("gestureScrollUpdate", | 530 .SetMethod("gestureScrollUpdate", |
528 &EventSenderBindings::GestureScrollUpdate) | 531 &EventSenderBindings::GestureScrollUpdate) |
532 .SetMethod("gesturePinchBegin", &EventSenderBindings::GesturePinchBegin) | |
533 .SetMethod("gesturePinchEnd", &EventSenderBindings::GesturePinchEnd) | |
534 .SetMethod("gesturePinchUpdate", &EventSenderBindings::GesturePinchUpdate) | |
529 .SetMethod("gestureTap", &EventSenderBindings::GestureTap) | 535 .SetMethod("gestureTap", &EventSenderBindings::GestureTap) |
530 .SetMethod("gestureTapDown", &EventSenderBindings::GestureTapDown) | 536 .SetMethod("gestureTapDown", &EventSenderBindings::GestureTapDown) |
531 .SetMethod("gestureShowPress", &EventSenderBindings::GestureShowPress) | 537 .SetMethod("gestureShowPress", &EventSenderBindings::GestureShowPress) |
532 .SetMethod("gestureTapCancel", &EventSenderBindings::GestureTapCancel) | 538 .SetMethod("gestureTapCancel", &EventSenderBindings::GestureTapCancel) |
533 .SetMethod("gestureLongPress", &EventSenderBindings::GestureLongPress) | 539 .SetMethod("gestureLongPress", &EventSenderBindings::GestureLongPress) |
534 .SetMethod("gestureLongTap", &EventSenderBindings::GestureLongTap) | 540 .SetMethod("gestureLongTap", &EventSenderBindings::GestureLongTap) |
535 .SetMethod("gestureTwoFingerTap", | 541 .SetMethod("gestureTwoFingerTap", |
536 &EventSenderBindings::GestureTwoFingerTap) | 542 &EventSenderBindings::GestureTwoFingerTap) |
537 .SetMethod("continuousMouseScrollBy", | 543 .SetMethod("continuousMouseScrollBy", |
538 &EventSenderBindings::ContinuousMouseScrollBy) | 544 &EventSenderBindings::ContinuousMouseScrollBy) |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
778 void EventSenderBindings::GestureScrollEnd(gin::Arguments* args) { | 784 void EventSenderBindings::GestureScrollEnd(gin::Arguments* args) { |
779 if (sender_) | 785 if (sender_) |
780 sender_->GestureScrollEnd(args); | 786 sender_->GestureScrollEnd(args); |
781 } | 787 } |
782 | 788 |
783 void EventSenderBindings::GestureScrollUpdate(gin::Arguments* args) { | 789 void EventSenderBindings::GestureScrollUpdate(gin::Arguments* args) { |
784 if (sender_) | 790 if (sender_) |
785 sender_->GestureScrollUpdate(args); | 791 sender_->GestureScrollUpdate(args); |
786 } | 792 } |
787 | 793 |
794 void EventSenderBindings::GesturePinchBegin(gin::Arguments* args) { | |
795 if (sender_) | |
796 sender_->GesturePinchBegin(args); | |
797 } | |
798 | |
799 void EventSenderBindings::GesturePinchEnd(gin::Arguments* args) { | |
800 if (sender_) | |
801 sender_->GesturePinchEnd(args); | |
802 } | |
803 | |
804 void EventSenderBindings::GesturePinchUpdate(gin::Arguments* args) { | |
805 if (sender_) | |
806 sender_->GesturePinchUpdate(args); | |
807 } | |
808 | |
788 void EventSenderBindings::GestureTap(gin::Arguments* args) { | 809 void EventSenderBindings::GestureTap(gin::Arguments* args) { |
789 if (sender_) | 810 if (sender_) |
790 sender_->GestureTap(args); | 811 sender_->GestureTap(args); |
791 } | 812 } |
792 | 813 |
793 void EventSenderBindings::GestureTapDown(gin::Arguments* args) { | 814 void EventSenderBindings::GestureTapDown(gin::Arguments* args) { |
794 if (sender_) | 815 if (sender_) |
795 sender_->GestureTapDown(args); | 816 sender_->GestureTapDown(args); |
796 } | 817 } |
797 | 818 |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1742 } | 1763 } |
1743 | 1764 |
1744 void EventSender::GestureScrollEnd(gin::Arguments* args) { | 1765 void EventSender::GestureScrollEnd(gin::Arguments* args) { |
1745 GestureEvent(WebInputEvent::GestureScrollEnd, args); | 1766 GestureEvent(WebInputEvent::GestureScrollEnd, args); |
1746 } | 1767 } |
1747 | 1768 |
1748 void EventSender::GestureScrollUpdate(gin::Arguments* args) { | 1769 void EventSender::GestureScrollUpdate(gin::Arguments* args) { |
1749 GestureEvent(WebInputEvent::GestureScrollUpdate, args); | 1770 GestureEvent(WebInputEvent::GestureScrollUpdate, args); |
1750 } | 1771 } |
1751 | 1772 |
1773 void EventSender::GesturePinchBegin(gin::Arguments* args) { | |
1774 GestureEvent(WebInputEvent::GesturePinchBegin, args); | |
1775 } | |
1776 | |
1777 void EventSender::GesturePinchEnd(gin::Arguments* args) { | |
1778 GestureEvent(WebInputEvent::GesturePinchEnd, args); | |
1779 } | |
1780 | |
1781 void EventSender::GesturePinchUpdate(gin::Arguments* args) { | |
1782 GestureEvent(WebInputEvent::GesturePinchUpdate, args); | |
1783 } | |
1784 | |
1752 void EventSender::GestureTap(gin::Arguments* args) { | 1785 void EventSender::GestureTap(gin::Arguments* args) { |
1753 GestureEvent(WebInputEvent::GestureTap, args); | 1786 GestureEvent(WebInputEvent::GestureTap, args); |
1754 } | 1787 } |
1755 | 1788 |
1756 void EventSender::GestureTapDown(gin::Arguments* args) { | 1789 void EventSender::GestureTapDown(gin::Arguments* args) { |
1757 GestureEvent(WebInputEvent::GestureTapDown, args); | 1790 GestureEvent(WebInputEvent::GestureTapDown, args); |
1758 } | 1791 } |
1759 | 1792 |
1760 void EventSender::GestureShowPress(gin::Arguments* args) { | 1793 void EventSender::GestureShowPress(gin::Arguments* args) { |
1761 GestureEvent(WebInputEvent::GestureShowPress, args); | 1794 GestureEvent(WebInputEvent::GestureShowPress, args); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1987 case WebInputEvent::GestureScrollBegin: | 2020 case WebInputEvent::GestureScrollBegin: |
1988 current_gesture_location_ = WebPoint(x, y); | 2021 current_gesture_location_ = WebPoint(x, y); |
1989 event.x = current_gesture_location_.x; | 2022 event.x = current_gesture_location_.x; |
1990 event.y = current_gesture_location_.y; | 2023 event.y = current_gesture_location_.y; |
1991 break; | 2024 break; |
1992 case WebInputEvent::GestureScrollEnd: | 2025 case WebInputEvent::GestureScrollEnd: |
1993 case WebInputEvent::GestureFlingStart: | 2026 case WebInputEvent::GestureFlingStart: |
1994 event.x = current_gesture_location_.x; | 2027 event.x = current_gesture_location_.x; |
1995 event.y = current_gesture_location_.y; | 2028 event.y = current_gesture_location_.y; |
1996 break; | 2029 break; |
2030 case WebInputEvent::GesturePinchBegin: | |
Rick Byers
2015/01/29 20:43:27
don't you need a way to specify the source device
ccameron
2015/01/29 21:30:40
Well, I'll want to test that touchscreen events do
| |
2031 case WebInputEvent::GesturePinchEnd: | |
2032 current_gesture_location_ = WebPoint(x, y); | |
2033 event.x = current_gesture_location_.x; | |
2034 event.y = current_gesture_location_.y; | |
2035 break; | |
2036 case WebInputEvent::GesturePinchUpdate: | |
2037 { | |
2038 float scale = 1; | |
2039 if (!args->PeekNext().IsEmpty()) { | |
2040 if (!args->GetNext(&scale)) { | |
2041 args->ThrowError(); | |
2042 return; | |
2043 } | |
2044 } | |
2045 event.data.pinchUpdate.scale = scale; | |
2046 current_gesture_location_ = WebPoint(x, y); | |
2047 event.x = current_gesture_location_.x; | |
2048 event.y = current_gesture_location_.y; | |
2049 break; | |
2050 } | |
1997 case WebInputEvent::GestureTap: | 2051 case WebInputEvent::GestureTap: |
1998 { | 2052 { |
1999 float tap_count = 1; | 2053 float tap_count = 1; |
2000 float width = 30; | 2054 float width = 30; |
2001 float height = 30; | 2055 float height = 30; |
2002 if (!args->PeekNext().IsEmpty()) { | 2056 if (!args->PeekNext().IsEmpty()) { |
2003 if (!args->GetNext(&tap_count)) { | 2057 if (!args->GetNext(&tap_count)) { |
2004 args->ThrowError(); | 2058 args->ThrowError(); |
2005 return; | 2059 return; |
2006 } | 2060 } |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2346 | 2400 |
2347 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { | 2401 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { |
2348 if (WebPagePopup* popup = view_->pagePopup()) { | 2402 if (WebPagePopup* popup = view_->pagePopup()) { |
2349 if (!WebInputEvent::isKeyboardEventType(event.type)) | 2403 if (!WebInputEvent::isKeyboardEventType(event.type)) |
2350 return popup->handleInputEvent(event); | 2404 return popup->handleInputEvent(event); |
2351 } | 2405 } |
2352 return view_->handleInputEvent(event); | 2406 return view_->handleInputEvent(event); |
2353 } | 2407 } |
2354 | 2408 |
2355 } // namespace content | 2409 } // namespace content |
OLD | NEW |