OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "content/browser/renderer_host/input/timeout_monitor.h" | 9 #include "content/browser/renderer_host/input/timeout_monitor.h" |
10 #include "content/browser/renderer_host/input/touch_event_queue.h" | 10 #include "content/browser/renderer_host/input/touch_event_queue.h" |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 // Queue a TouchStart. | 852 // Queue a TouchStart. |
853 PressTouchPoint(0, 1); | 853 PressTouchPoint(0, 1); |
854 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 854 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
855 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 855 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
856 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 856 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
857 | 857 |
858 MoveTouchPoint(0, 20, 5); | 858 MoveTouchPoint(0, 20, 5); |
859 EXPECT_EQ(1U, queued_event_count()); | 859 EXPECT_EQ(1U, queued_event_count()); |
860 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 860 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
861 | 861 |
| 862 MoveTouchPoint(0, 30, 15); |
| 863 EXPECT_EQ(2U, queued_event_count()); |
| 864 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
| 865 |
862 // Queue another TouchStart. | 866 // Queue another TouchStart. |
863 PressTouchPoint(20, 20); | 867 PressTouchPoint(20, 20); |
864 EXPECT_EQ(2U, queued_event_count()); | 868 EXPECT_EQ(3U, queued_event_count()); |
865 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 869 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
866 EXPECT_EQ(WebInputEvent::TouchStart, latest_event().type); | 870 EXPECT_EQ(WebInputEvent::TouchStart, latest_event().type); |
867 | 871 |
868 // GestureScrollBegin inserts a synthetic TouchCancel before the TouchStart. | |
869 WebGestureEvent followup_scroll; | 872 WebGestureEvent followup_scroll; |
870 followup_scroll.type = WebInputEvent::GestureScrollBegin; | 873 followup_scroll.type = WebInputEvent::GestureScrollBegin; |
871 SetFollowupEvent(followup_scroll); | 874 SetFollowupEvent(followup_scroll); |
872 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 875 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
873 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 876 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
874 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 877 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
875 EXPECT_EQ(2U, queued_event_count()); | 878 EXPECT_EQ(2U, queued_event_count()); |
| 879 EXPECT_TRUE(sent_event().cancelable); |
| 880 EXPECT_EQ(WebInputEvent::TouchMove, sent_event().type); |
| 881 |
| 882 // GestureScrollUpdate inserts a synthetic TouchCancel before the TouchStart. |
| 883 followup_scroll.type = WebInputEvent::GestureScrollUpdate; |
| 884 SetFollowupEvent(followup_scroll); |
| 885 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 886 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 887 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 888 EXPECT_EQ(2U, queued_event_count()); |
876 EXPECT_EQ(WebInputEvent::TouchCancel, sent_event().type); | 889 EXPECT_EQ(WebInputEvent::TouchCancel, sent_event().type); |
877 EXPECT_FALSE(sent_event().cancelable); | 890 EXPECT_FALSE(sent_event().cancelable); |
878 EXPECT_EQ(WebInputEvent::TouchStart, latest_event().type); | 891 EXPECT_EQ(WebInputEvent::TouchStart, latest_event().type); |
879 | 892 |
880 // Acking the TouchCancel will result in dispatch of the next TouchStart. | 893 // Acking the TouchCancel will result in dispatch of the next TouchStart. |
881 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 894 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
882 // The synthetic TouchCancel should not reach client, only the TouchStart. | 895 // The synthetic TouchCancel should not reach client, only the TouchStart. |
883 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 896 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
884 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 897 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
885 EXPECT_EQ(WebInputEvent::TouchStart, acked_event().type); | 898 EXPECT_EQ(WebInputEvent::TouchStart, acked_event().type); |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 // scroll sequences that transitions between scrolls consumed and unconsumed. | 1723 // scroll sequences that transitions between scrolls consumed and unconsumed. |
1711 TEST_F(TouchEventQueueTest, AsyncTouchThrottledAfterScroll) { | 1724 TEST_F(TouchEventQueueTest, AsyncTouchThrottledAfterScroll) { |
1712 SetTouchScrollingMode(TouchEventQueue::TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE); | 1725 SetTouchScrollingMode(TouchEventQueue::TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE); |
1713 | 1726 |
1714 // Process a TouchStart | 1727 // Process a TouchStart |
1715 PressTouchPoint(0, 1); | 1728 PressTouchPoint(0, 1); |
1716 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 1729 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
1717 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1730 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1718 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 1731 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
1719 | 1732 |
1720 // Now send the first touch move and associated GestureScrollBegin, | 1733 // Now send the first touch move and associated GestureScrollBegin. |
1721 // but don't ACK the gesture event yet. | |
1722 MoveTouchPoint(0, 0, 5); | 1734 MoveTouchPoint(0, 0, 5); |
1723 WebGestureEvent followup_scroll; | 1735 WebGestureEvent followup_scroll; |
1724 followup_scroll.type = WebInputEvent::GestureScrollBegin; | 1736 followup_scroll.type = WebInputEvent::GestureScrollBegin; |
1725 SetFollowupEvent(followup_scroll); | 1737 SetFollowupEvent(followup_scroll); |
1726 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1738 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1727 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 1739 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
1728 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 1740 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 1741 SendGestureEventAck(WebInputEvent::GestureScrollBegin, |
| 1742 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 1743 |
| 1744 // Send the second touch move and associated GestureScrollUpdate, but don't |
| 1745 // ACK the gesture event yet. |
| 1746 MoveTouchPoint(0, 0, 50); |
| 1747 followup_scroll.type = WebInputEvent::GestureScrollUpdate; |
| 1748 SetFollowupEvent(followup_scroll); |
| 1749 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 1750 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 1751 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
1729 | 1752 |
1730 // Now queue a second touchmove and verify it's not (yet) dispatched. | 1753 // Now queue a second touchmove and verify it's not (yet) dispatched. |
1731 MoveTouchPoint(0, 0, 10); | 1754 MoveTouchPoint(0, 0, 100); |
| 1755 SetFollowupEvent(followup_scroll); |
1732 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1756 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1733 EXPECT_TRUE(HasPendingAsyncTouchMove()); | 1757 EXPECT_TRUE(HasPendingAsyncTouchMove()); |
1734 EXPECT_EQ(0U, queued_event_count()); | 1758 EXPECT_EQ(0U, queued_event_count()); |
1735 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 1759 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
1736 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 1760 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
1737 | 1761 |
1738 // Queuing the final touchend should flush the pending, async touchmove. | 1762 // Queuing the final touchend should flush the pending, async touchmove. |
1739 ReleaseTouchPoint(0); | 1763 ReleaseTouchPoint(0); |
| 1764 followup_scroll.type = WebInputEvent::GestureScrollEnd; |
| 1765 SetFollowupEvent(followup_scroll); |
1740 EXPECT_EQ(WebInputEvent::TouchMove, sent_event().type); | 1766 EXPECT_EQ(WebInputEvent::TouchMove, sent_event().type); |
1741 EXPECT_FALSE(HasPendingAsyncTouchMove()); | 1767 EXPECT_FALSE(HasPendingAsyncTouchMove()); |
1742 EXPECT_FALSE(sent_event().cancelable); | 1768 EXPECT_FALSE(sent_event().cancelable); |
1743 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 1769 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
1744 EXPECT_EQ(2U, queued_event_count()); | 1770 EXPECT_EQ(2U, queued_event_count()); |
1745 | 1771 |
1746 // Ack the flushed, async touchmove. The ack should not reach the client, but | 1772 // Ack the flushed, async touchmove. The ack should not reach the client, but |
1747 // it should trigger sending of the (now non-cancelable) touchend. | 1773 // it should trigger sending of the (now non-cancelable) touchend. |
1748 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1774 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1749 EXPECT_EQ(WebInputEvent::TouchEnd, sent_event().type); | 1775 EXPECT_EQ(WebInputEvent::TouchEnd, sent_event().type); |
1750 EXPECT_FALSE(sent_event().cancelable); | 1776 EXPECT_FALSE(sent_event().cancelable); |
1751 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 1777 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
1752 EXPECT_EQ(0U, GetAndResetAckedEventCount()); | 1778 EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
1753 EXPECT_EQ(1U, queued_event_count()); | 1779 EXPECT_EQ(1U, queued_event_count()); |
1754 | 1780 |
1755 // Ack the touchend. | 1781 // Ack the touchend. |
1756 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1782 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1757 EXPECT_EQ(0U, queued_event_count()); | 1783 EXPECT_EQ(0U, queued_event_count()); |
1758 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 1784 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
1759 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 1785 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
1760 | 1786 |
1761 // Now mark the scroll as not consumed (which would cause future | 1787 // Now mark the scrolls as not consumed (which would cause future touchmoves |
1762 // touchmoves in the active sequence to be sent if there was one). | 1788 // in the active sequence to be sent if there was one). |
1763 SendGestureEventAck(WebInputEvent::GestureScrollBegin, | 1789 SendGestureEventAck(WebInputEvent::GestureScrollUpdate, |
1764 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1790 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 1791 SendGestureEventAck(WebInputEvent::GestureScrollUpdate, |
| 1792 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1765 | 1793 |
1766 // Start a new touch sequence and verify that throttling has been reset. | 1794 // Start a new touch sequence and verify that throttling has been reset. |
1767 // Touch moves after the start of scrolling will again be throttled. | 1795 // Touch moves after the start of scrolling will again be throttled. |
1768 PressTouchPoint(0, 0); | 1796 PressTouchPoint(0, 0); |
1769 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 1797 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
1770 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1798 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1771 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 1799 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
1772 MoveTouchPoint(0, 0, 5); | 1800 MoveTouchPoint(0, 0, 5); |
| 1801 followup_scroll.type = WebInputEvent::GestureScrollBegin; |
1773 SetFollowupEvent(followup_scroll); | 1802 SetFollowupEvent(followup_scroll); |
1774 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1803 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1775 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 1804 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
1776 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 1805 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 1806 |
| 1807 MoveTouchPoint(0, 0, 5); |
| 1808 followup_scroll.type = WebInputEvent::GestureScrollUpdate; |
| 1809 SetFollowupEvent(followup_scroll); |
| 1810 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 1811 EXPECT_FALSE(HasPendingAsyncTouchMove()); |
| 1812 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 1813 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 1814 |
1777 MoveTouchPoint(0, 0, 10); | 1815 MoveTouchPoint(0, 0, 10); |
1778 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 1816 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1779 EXPECT_TRUE(HasPendingAsyncTouchMove()); | 1817 EXPECT_TRUE(HasPendingAsyncTouchMove()); |
1780 EXPECT_EQ(0U, queued_event_count()); | 1818 EXPECT_EQ(0U, queued_event_count()); |
1781 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 1819 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
1782 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 1820 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
1783 | 1821 |
1784 // As soon as a touchmove exceeds the outer slop region it will be forwarded | 1822 // As soon as a touchmove exceeds the outer slop region it will be forwarded |
1785 // immediately. | 1823 // immediately. |
1786 MoveTouchPoint(0, 0, 20); | 1824 MoveTouchPoint(0, 0, 20); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 // The start of a scroll gesture should trigger async touch event dispatch. | 2024 // The start of a scroll gesture should trigger async touch event dispatch. |
1987 MoveTouchPoint(0, 1, 1); | 2025 MoveTouchPoint(0, 1, 1); |
1988 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 2026 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
1989 WebGestureEvent followup_scroll; | 2027 WebGestureEvent followup_scroll; |
1990 followup_scroll.type = WebInputEvent::GestureScrollBegin; | 2028 followup_scroll.type = WebInputEvent::GestureScrollBegin; |
1991 SetFollowupEvent(followup_scroll); | 2029 SetFollowupEvent(followup_scroll); |
1992 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2030 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
1993 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 2031 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
1994 EXPECT_EQ(0U, queued_event_count()); | 2032 EXPECT_EQ(0U, queued_event_count()); |
1995 | 2033 |
| 2034 SendGestureEvent(WebInputEvent::GestureScrollUpdate); |
| 2035 |
1996 // The async touchmove should be ack'ed immediately, but not forwarded. | 2036 // The async touchmove should be ack'ed immediately, but not forwarded. |
1997 // However, because the ack triggers a touchcancel, both the pending touch and | 2037 // However, because the ack triggers a touchcancel, both the pending touch and |
1998 // the queued touchcancel should be flushed. | 2038 // the queued touchcancel should be flushed. |
1999 WebTouchEvent followup_cancel; | 2039 WebTouchEvent followup_cancel; |
2000 followup_cancel.type = WebInputEvent::TouchCancel; | 2040 followup_cancel.type = WebInputEvent::TouchCancel; |
2001 followup_cancel.touchesLength = 1; | 2041 followup_cancel.touchesLength = 1; |
2002 followup_cancel.touches[0].state = WebTouchPoint::StateCancelled; | 2042 followup_cancel.touches[0].state = WebTouchPoint::StateCancelled; |
2003 SetFollowupEvent(followup_cancel); | 2043 SetFollowupEvent(followup_cancel); |
2004 MoveTouchPoint(0, 5, 5); | 2044 MoveTouchPoint(0, 5, 5); |
2005 EXPECT_EQ(2U, queued_event_count()); | 2045 EXPECT_EQ(2U, queued_event_count()); |
2006 EXPECT_FALSE(sent_event().cancelable); | 2046 EXPECT_FALSE(sent_event().cancelable); |
2007 EXPECT_FALSE(HasPendingAsyncTouchMove()); | 2047 EXPECT_FALSE(HasPendingAsyncTouchMove()); |
2008 EXPECT_EQ(WebInputEvent::TouchMove, acked_event().type); | 2048 EXPECT_EQ(WebInputEvent::TouchMove, acked_event().type); |
2009 EXPECT_EQ(WebInputEvent::TouchMove, sent_event().type); | 2049 EXPECT_EQ(WebInputEvent::TouchMove, sent_event().type); |
2010 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 2050 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
2011 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 2051 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
2012 | 2052 |
2013 // The ack for the asnc touchmove should not reach the client, as it has | 2053 // The ack for the async touchmove should not reach the client, as it has |
2014 // already been ack'ed. | 2054 // already been ack'ed. |
2015 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2055 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2016 EXPECT_FALSE(sent_event().cancelable); | 2056 EXPECT_FALSE(sent_event().cancelable); |
2017 EXPECT_EQ(1U, queued_event_count()); | 2057 EXPECT_EQ(1U, queued_event_count()); |
2018 EXPECT_EQ(WebInputEvent::TouchCancel, sent_event().type); | 2058 EXPECT_EQ(WebInputEvent::TouchCancel, sent_event().type); |
2019 EXPECT_EQ(0U, GetAndResetAckedEventCount()); | 2059 EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
2020 EXPECT_EQ(1U, GetAndResetSentEventCount()); | 2060 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
2021 | 2061 |
2022 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2062 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2023 EXPECT_EQ(0U, queued_event_count()); | 2063 EXPECT_EQ(0U, queued_event_count()); |
2024 EXPECT_EQ(WebInputEvent::TouchCancel, acked_event().type); | 2064 EXPECT_EQ(WebInputEvent::TouchCancel, acked_event().type); |
2025 EXPECT_EQ(1U, GetAndResetAckedEventCount()); | 2065 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
2026 EXPECT_EQ(0U, GetAndResetSentEventCount()); | 2066 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
2027 } | 2067 } |
2028 | 2068 |
| 2069 TEST_F(TouchEventQueueTest, TouchAbsorptionWithConsumedFirstMove) { |
| 2070 SetTouchScrollingMode(TouchEventQueue::TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE); |
| 2071 |
| 2072 // Queue a TouchStart. |
| 2073 PressTouchPoint(0, 1); |
| 2074 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2075 EXPECT_EQ(0U, queued_event_count()); |
| 2076 EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
| 2077 |
| 2078 MoveTouchPoint(0, 20, 5); |
| 2079 SendGestureEvent(blink::WebInputEvent::GestureScrollBegin); |
| 2080 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); |
| 2081 EXPECT_EQ(0U, queued_event_count()); |
| 2082 EXPECT_EQ(2U, GetAndResetSentEventCount()); |
| 2083 |
| 2084 // Even if the first touchmove event was consumed, subsequent unconsumed |
| 2085 // touchmove events should trigger scrolling. |
| 2086 MoveTouchPoint(0, 60, 5); |
| 2087 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); |
| 2088 EXPECT_EQ(0U, queued_event_count()); |
| 2089 EXPECT_TRUE(sent_event().cancelable); |
| 2090 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 2091 |
| 2092 MoveTouchPoint(0, 20, 5); |
| 2093 WebGestureEvent followup_scroll; |
| 2094 followup_scroll.type = WebInputEvent::GestureScrollUpdate; |
| 2095 SetFollowupEvent(followup_scroll); |
| 2096 SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2097 SendGestureEventAck(WebInputEvent::GestureScrollUpdate, |
| 2098 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 2099 EXPECT_EQ(0U, queued_event_count()); |
| 2100 EXPECT_TRUE(sent_event().cancelable); |
| 2101 EXPECT_EQ(1U, GetAndResetSentEventCount()); |
| 2102 |
| 2103 // Touch move event is throttled. |
| 2104 MoveTouchPoint(0, 60, 5); |
| 2105 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); |
| 2106 EXPECT_EQ(0U, queued_event_count()); |
| 2107 EXPECT_EQ(0U, GetAndResetSentEventCount()); |
| 2108 } |
| 2109 |
2029 } // namespace content | 2110 } // namespace content |
OLD | NEW |