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/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 void GesturePinchUpdate(gin::Arguments* args); | 410 void GesturePinchUpdate(gin::Arguments* args); |
411 void GestureTap(gin::Arguments* args); | 411 void GestureTap(gin::Arguments* args); |
412 void GestureTapDown(gin::Arguments* args); | 412 void GestureTapDown(gin::Arguments* args); |
413 void GestureShowPress(gin::Arguments* args); | 413 void GestureShowPress(gin::Arguments* args); |
414 void GestureTapCancel(gin::Arguments* args); | 414 void GestureTapCancel(gin::Arguments* args); |
415 void GestureLongPress(gin::Arguments* args); | 415 void GestureLongPress(gin::Arguments* args); |
416 void GestureLongTap(gin::Arguments* args); | 416 void GestureLongTap(gin::Arguments* args); |
417 void GestureTwoFingerTap(gin::Arguments* args); | 417 void GestureTwoFingerTap(gin::Arguments* args); |
418 void ContinuousMouseScrollBy(gin::Arguments* args); | 418 void ContinuousMouseScrollBy(gin::Arguments* args); |
419 void MouseMoveTo(gin::Arguments* args); | 419 void MouseMoveTo(gin::Arguments* args); |
| 420 void MouseLeave(); |
420 void TrackpadScrollBegin(); | 421 void TrackpadScrollBegin(); |
421 void TrackpadScroll(gin::Arguments* args); | 422 void TrackpadScroll(gin::Arguments* args); |
422 void TrackpadScrollEnd(); | 423 void TrackpadScrollEnd(); |
423 void MouseScrollBy(gin::Arguments* args); | 424 void MouseScrollBy(gin::Arguments* args); |
424 // TODO(erikchen): Remove MouseMomentumBegin once CL 282743002 has landed. | 425 // TODO(erikchen): Remove MouseMomentumBegin once CL 282743002 has landed. |
425 void MouseMomentumBegin(); | 426 void MouseMomentumBegin(); |
426 void MouseMomentumBegin2(gin::Arguments* args); | 427 void MouseMomentumBegin2(gin::Arguments* args); |
427 void MouseMomentumScrollBy(gin::Arguments* args); | 428 void MouseMomentumScrollBy(gin::Arguments* args); |
428 void MouseMomentumEnd(); | 429 void MouseMomentumEnd(); |
429 void ScheduleAsynchronousClick(gin::Arguments* args); | 430 void ScheduleAsynchronousClick(gin::Arguments* args); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 .SetMethod("gestureTapCancel", &EventSenderBindings::GestureTapCancel) | 548 .SetMethod("gestureTapCancel", &EventSenderBindings::GestureTapCancel) |
548 .SetMethod("gestureLongPress", &EventSenderBindings::GestureLongPress) | 549 .SetMethod("gestureLongPress", &EventSenderBindings::GestureLongPress) |
549 .SetMethod("gestureLongTap", &EventSenderBindings::GestureLongTap) | 550 .SetMethod("gestureLongTap", &EventSenderBindings::GestureLongTap) |
550 .SetMethod("gestureTwoFingerTap", | 551 .SetMethod("gestureTwoFingerTap", |
551 &EventSenderBindings::GestureTwoFingerTap) | 552 &EventSenderBindings::GestureTwoFingerTap) |
552 .SetMethod("continuousMouseScrollBy", | 553 .SetMethod("continuousMouseScrollBy", |
553 &EventSenderBindings::ContinuousMouseScrollBy) | 554 &EventSenderBindings::ContinuousMouseScrollBy) |
554 .SetMethod("keyDown", &EventSenderBindings::KeyDown) | 555 .SetMethod("keyDown", &EventSenderBindings::KeyDown) |
555 .SetMethod("mouseDown", &EventSenderBindings::MouseDown) | 556 .SetMethod("mouseDown", &EventSenderBindings::MouseDown) |
556 .SetMethod("mouseMoveTo", &EventSenderBindings::MouseMoveTo) | 557 .SetMethod("mouseMoveTo", &EventSenderBindings::MouseMoveTo) |
| 558 .SetMethod("mouseLeave", &EventSenderBindings::MouseLeave) |
557 .SetMethod("trackpadScrollBegin", | 559 .SetMethod("trackpadScrollBegin", |
558 &EventSenderBindings::TrackpadScrollBegin) | 560 &EventSenderBindings::TrackpadScrollBegin) |
559 .SetMethod("trackpadScroll", &EventSenderBindings::TrackpadScroll) | 561 .SetMethod("trackpadScroll", &EventSenderBindings::TrackpadScroll) |
560 .SetMethod("trackpadScrollEnd", &EventSenderBindings::TrackpadScrollEnd) | 562 .SetMethod("trackpadScrollEnd", &EventSenderBindings::TrackpadScrollEnd) |
561 .SetMethod("mouseScrollBy", &EventSenderBindings::MouseScrollBy) | 563 .SetMethod("mouseScrollBy", &EventSenderBindings::MouseScrollBy) |
562 .SetMethod("mouseUp", &EventSenderBindings::MouseUp) | 564 .SetMethod("mouseUp", &EventSenderBindings::MouseUp) |
563 .SetMethod("mouseMomentumBegin", &EventSenderBindings::MouseMomentumBegin) | 565 .SetMethod("mouseMomentumBegin", &EventSenderBindings::MouseMomentumBegin) |
564 .SetMethod("mouseMomentumBegin2", | 566 .SetMethod("mouseMomentumBegin2", |
565 &EventSenderBindings::MouseMomentumBegin2) | 567 &EventSenderBindings::MouseMomentumBegin2) |
566 .SetMethod("mouseMomentumScrollBy", | 568 .SetMethod("mouseMomentumScrollBy", |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 void EventSenderBindings::ContinuousMouseScrollBy(gin::Arguments* args) { | 856 void EventSenderBindings::ContinuousMouseScrollBy(gin::Arguments* args) { |
855 if (sender_) | 857 if (sender_) |
856 sender_->ContinuousMouseScrollBy(args); | 858 sender_->ContinuousMouseScrollBy(args); |
857 } | 859 } |
858 | 860 |
859 void EventSenderBindings::MouseMoveTo(gin::Arguments* args) { | 861 void EventSenderBindings::MouseMoveTo(gin::Arguments* args) { |
860 if (sender_) | 862 if (sender_) |
861 sender_->MouseMoveTo(args); | 863 sender_->MouseMoveTo(args); |
862 } | 864 } |
863 | 865 |
| 866 void EventSenderBindings::MouseLeave() { |
| 867 if (sender_) |
| 868 sender_->MouseLeave(); |
| 869 } |
| 870 |
864 void EventSenderBindings::TrackpadScrollBegin() { | 871 void EventSenderBindings::TrackpadScrollBegin() { |
865 if (sender_) | 872 if (sender_) |
866 sender_->TrackpadScrollBegin(); | 873 sender_->TrackpadScrollBegin(); |
867 } | 874 } |
868 | 875 |
869 void EventSenderBindings::TrackpadScroll(gin::Arguments* args) { | 876 void EventSenderBindings::TrackpadScroll(gin::Arguments* args) { |
870 if (sender_) | 877 if (sender_) |
871 sender_->TrackpadScroll(args); | 878 sender_->TrackpadScroll(args); |
872 } | 879 } |
873 | 880 |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 pressed_button_, | 1913 pressed_button_, |
1907 mouse_pos, | 1914 mouse_pos, |
1908 GetCurrentEventTimeSec(), | 1915 GetCurrentEventTimeSec(), |
1909 click_count_, | 1916 click_count_, |
1910 modifiers, | 1917 modifiers, |
1911 &event); | 1918 &event); |
1912 DoMouseMove(event); | 1919 DoMouseMove(event); |
1913 } | 1920 } |
1914 } | 1921 } |
1915 | 1922 |
| 1923 void EventSender::MouseLeave() { |
| 1924 if (force_layout_on_events_) |
| 1925 view_->layout(); |
| 1926 |
| 1927 WebMouseEvent event; |
| 1928 InitMouseEvent(WebInputEvent::MouseLeave, |
| 1929 WebMouseEvent::ButtonNone, |
| 1930 last_mouse_pos_, |
| 1931 GetCurrentEventTimeSec(), |
| 1932 click_count_, |
| 1933 0, |
| 1934 &event); |
| 1935 view_->handleInputEvent(event); |
| 1936 } |
| 1937 |
| 1938 |
1916 void EventSender::TrackpadScrollBegin() { | 1939 void EventSender::TrackpadScrollBegin() { |
1917 WebMouseWheelEvent event; | 1940 WebMouseWheelEvent event; |
1918 InitMouseEvent(WebInputEvent::MouseWheel, | 1941 InitMouseEvent(WebInputEvent::MouseWheel, |
1919 WebMouseEvent::ButtonNone, | 1942 WebMouseEvent::ButtonNone, |
1920 last_mouse_pos_, | 1943 last_mouse_pos_, |
1921 GetCurrentEventTimeSec(), | 1944 GetCurrentEventTimeSec(), |
1922 click_count_, | 1945 click_count_, |
1923 0, | 1946 0, |
1924 &event); | 1947 &event); |
1925 event.phase = blink::WebMouseWheelEvent::PhaseBegan; | 1948 event.phase = blink::WebMouseWheelEvent::PhaseBegan; |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 | 2504 |
2482 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { | 2505 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { |
2483 if (WebPagePopup* popup = view_->pagePopup()) { | 2506 if (WebPagePopup* popup = view_->pagePopup()) { |
2484 if (!WebInputEvent::isKeyboardEventType(event.type)) | 2507 if (!WebInputEvent::isKeyboardEventType(event.type)) |
2485 return popup->handleInputEvent(event); | 2508 return popup->handleInputEvent(event); |
2486 } | 2509 } |
2487 return view_->handleInputEvent(event); | 2510 return view_->handleInputEvent(event); |
2488 } | 2511 } |
2489 | 2512 |
2490 } // namespace content | 2513 } // namespace content |
OLD | NEW |