| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 void SetTouchCancelable(bool cancelable); | 509 void SetTouchCancelable(bool cancelable); |
| 510 void DumpFilenameBeingDragged(); | 510 void DumpFilenameBeingDragged(); |
| 511 void GestureFlingCancel(); | 511 void GestureFlingCancel(); |
| 512 void GestureFlingStart(float x, | 512 void GestureFlingStart(float x, |
| 513 float y, | 513 float y, |
| 514 float velocity_x, | 514 float velocity_x, |
| 515 float velocity_y, | 515 float velocity_y, |
| 516 gin::Arguments* args); | 516 gin::Arguments* args); |
| 517 bool IsFlinging() const; | 517 bool IsFlinging() const; |
| 518 void GestureScrollFirstPoint(int x, int y); | 518 void GestureScrollFirstPoint(int x, int y); |
| 519 void TouchStart(); | 519 void TouchStart(gin::Arguments* args); |
| 520 void TouchMove(); | 520 void TouchMove(gin::Arguments* args); |
| 521 void TouchMoveCausingScrollIfUncanceled(); | 521 void TouchCancel(gin::Arguments* args); |
| 522 void TouchCancel(); | 522 void TouchEnd(gin::Arguments* args); |
| 523 void TouchEnd(); | |
| 524 void NotifyStartOfTouchScroll(); | 523 void NotifyStartOfTouchScroll(); |
| 525 void LeapForward(int milliseconds); | 524 void LeapForward(int milliseconds); |
| 526 double LastEventTimestamp(); | 525 double LastEventTimestamp(); |
| 527 void BeginDragWithFiles(const std::vector<std::string>& files); | 526 void BeginDragWithFiles(const std::vector<std::string>& files); |
| 528 void AddTouchPoint(double x, double y, gin::Arguments* args); | 527 void AddTouchPoint(double x, double y, gin::Arguments* args); |
| 529 void GestureScrollBegin(gin::Arguments* args); | 528 void GestureScrollBegin(gin::Arguments* args); |
| 530 void GestureScrollEnd(gin::Arguments* args); | 529 void GestureScrollEnd(gin::Arguments* args); |
| 531 void GestureScrollUpdate(gin::Arguments* args); | 530 void GestureScrollUpdate(gin::Arguments* args); |
| 532 void GesturePinchBegin(gin::Arguments* args); | 531 void GesturePinchBegin(gin::Arguments* args); |
| 533 void GesturePinchEnd(gin::Arguments* args); | 532 void GesturePinchEnd(gin::Arguments* args); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 if (sender_) | 809 if (sender_) |
| 811 return sender_->IsFlinging(); | 810 return sender_->IsFlinging(); |
| 812 return false; | 811 return false; |
| 813 } | 812 } |
| 814 | 813 |
| 815 void EventSenderBindings::GestureScrollFirstPoint(int x, int y) { | 814 void EventSenderBindings::GestureScrollFirstPoint(int x, int y) { |
| 816 if (sender_) | 815 if (sender_) |
| 817 sender_->GestureScrollFirstPoint(x, y); | 816 sender_->GestureScrollFirstPoint(x, y); |
| 818 } | 817 } |
| 819 | 818 |
| 820 void EventSenderBindings::TouchStart() { | 819 void EventSenderBindings::TouchStart(gin::Arguments* args) { |
| 821 if (sender_) | 820 if (sender_) |
| 822 sender_->TouchStart(); | 821 sender_->TouchStart(args); |
| 823 } | 822 } |
| 824 | 823 |
| 825 void EventSenderBindings::TouchMove() { | 824 void EventSenderBindings::TouchMove(gin::Arguments* args) { |
| 826 if (sender_) | 825 if (sender_) |
| 827 sender_->TouchMove(); | 826 sender_->TouchMove(args); |
| 828 } | 827 } |
| 829 | 828 |
| 830 void EventSenderBindings::TouchCancel() { | 829 void EventSenderBindings::TouchCancel(gin::Arguments* args) { |
| 831 if (sender_) | 830 if (sender_) |
| 832 sender_->TouchCancel(); | 831 sender_->TouchCancel(args); |
| 833 } | 832 } |
| 834 | 833 |
| 835 void EventSenderBindings::TouchEnd() { | 834 void EventSenderBindings::TouchEnd(gin::Arguments* args) { |
| 836 if (sender_) | 835 if (sender_) |
| 837 sender_->TouchEnd(); | 836 sender_->TouchEnd(args); |
| 838 } | 837 } |
| 839 | 838 |
| 840 void EventSenderBindings::NotifyStartOfTouchScroll() { | 839 void EventSenderBindings::NotifyStartOfTouchScroll() { |
| 841 if (sender_) | 840 if (sender_) |
| 842 sender_->NotifyStartOfTouchScroll(); | 841 sender_->NotifyStartOfTouchScroll(); |
| 843 } | 842 } |
| 844 | 843 |
| 845 void EventSenderBindings::LeapForward(int milliseconds) { | 844 void EventSenderBindings::LeapForward(int milliseconds) { |
| 846 if (sender_) | 845 if (sender_) |
| 847 sender_->LeapForward(milliseconds); | 846 sender_->LeapForward(milliseconds); |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 } | 1874 } |
| 1876 | 1875 |
| 1877 bool EventSender::IsFlinging() const { | 1876 bool EventSender::IsFlinging() const { |
| 1878 return view()->isFlinging(); | 1877 return view()->isFlinging(); |
| 1879 } | 1878 } |
| 1880 | 1879 |
| 1881 void EventSender::GestureScrollFirstPoint(int x, int y) { | 1880 void EventSender::GestureScrollFirstPoint(int x, int y) { |
| 1882 current_gesture_location_ = WebPoint(x, y); | 1881 current_gesture_location_ = WebPoint(x, y); |
| 1883 } | 1882 } |
| 1884 | 1883 |
| 1885 void EventSender::TouchStart() { | 1884 bool EventSender::GetMovedBeyondSlopRegionArg(gin::Arguments* args) { |
| 1886 SendCurrentTouchEvent(WebInputEvent::TouchStart, false); | 1885 std::string arg; |
| 1886 if (args->PeekNext().IsEmpty()) |
| 1887 return false; |
| 1888 |
| 1889 if(args->PeekNext()->IsString() && args->GetNext(&arg)) { |
| 1890 if (arg == "movedBeyondSlopRegion") |
| 1891 return true; |
| 1892 } |
| 1893 |
| 1894 args->ThrowError(); |
| 1895 return false; |
| 1887 } | 1896 } |
| 1888 | 1897 |
| 1889 void EventSender::TouchMove() { | 1898 void EventSender::TouchStart(gin::Arguments* args) { |
| 1890 SendCurrentTouchEvent(WebInputEvent::TouchMove, false); | 1899 SendCurrentTouchEvent(WebInputEvent::TouchStart, |
| 1900 GetMovedBeyondSlopRegionArg(args)); |
| 1891 } | 1901 } |
| 1892 | 1902 |
| 1893 void EventSender::TouchCancel() { | 1903 void EventSender::TouchMove(gin::Arguments* args) { |
| 1894 SendCurrentTouchEvent(WebInputEvent::TouchCancel, false); | 1904 SendCurrentTouchEvent(WebInputEvent::TouchMove, |
| 1905 GetMovedBeyondSlopRegionArg(args)); |
| 1895 } | 1906 } |
| 1896 | 1907 |
| 1897 void EventSender::TouchEnd() { | 1908 void EventSender::TouchCancel(gin::Arguments* args) { |
| 1898 SendCurrentTouchEvent(WebInputEvent::TouchEnd, false); | 1909 SendCurrentTouchEvent(WebInputEvent::TouchCancel, |
| 1910 GetMovedBeyondSlopRegionArg(args)); |
| 1911 } |
| 1912 |
| 1913 void EventSender::TouchEnd(gin::Arguments* args) { |
| 1914 SendCurrentTouchEvent(WebInputEvent::TouchEnd, |
| 1915 GetMovedBeyondSlopRegionArg(args)); |
| 1899 } | 1916 } |
| 1900 | 1917 |
| 1901 void EventSender::NotifyStartOfTouchScroll() { | 1918 void EventSender::NotifyStartOfTouchScroll() { |
| 1902 WebTouchEvent event; | 1919 WebTouchEvent event; |
| 1903 event.type = WebInputEvent::TouchScrollStarted; | 1920 event.type = WebInputEvent::TouchScrollStarted; |
| 1904 HandleInputEventOnViewOrPopup(event); | 1921 HandleInputEventOnViewOrPopup(event); |
| 1905 } | 1922 } |
| 1906 | 1923 |
| 1907 void EventSender::LeapForward(int milliseconds) { | 1924 void EventSender::LeapForward(int milliseconds) { |
| 1908 if (is_drag_mode_ && | 1925 if (is_drag_mode_ && |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2773 | 2790 |
| 2774 const blink::WebView* EventSender::view() const { | 2791 const blink::WebView* EventSender::view() const { |
| 2775 return web_test_proxy_base_->web_view(); | 2792 return web_test_proxy_base_->web_view(); |
| 2776 } | 2793 } |
| 2777 | 2794 |
| 2778 blink::WebView* EventSender::view() { | 2795 blink::WebView* EventSender::view() { |
| 2779 return web_test_proxy_base_->web_view(); | 2796 return web_test_proxy_base_->web_view(); |
| 2780 } | 2797 } |
| 2781 | 2798 |
| 2782 } // namespace test_runner | 2799 } // namespace test_runner |
| OLD | NEW |