Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 12087140: Suppress touchscreen tap immediately after a GestureFlingCancel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/shared_memory.h" 7 #include "base/shared_memory.h"
8 #include "base/timer.h" 8 #include "base/timer.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/renderer_host/backing_store.h" 10 #include "content/browser/renderer_host/backing_store.h"
11 #include "content/browser/renderer_host/render_widget_host_delegate.h" 11 #include "content/browser/renderer_host/render_widget_host_delegate.h"
12 #include "content/browser/renderer_host/gesture_event_filter.h" 12 #include "content/browser/renderer_host/gesture_event_filter.h"
13 #include "content/browser/renderer_host/overscroll_controller.h" 13 #include "content/browser/renderer_host/overscroll_controller.h"
14 #include "content/browser/renderer_host/overscroll_controller_delegate.h" 14 #include "content/browser/renderer_host/overscroll_controller_delegate.h"
15 #include "content/browser/renderer_host/tap_suppression_controller.h"
16 #include "content/browser/renderer_host/test_render_view_host.h" 15 #include "content/browser/renderer_host/test_render_view_host.h"
17 #include "content/browser/renderer_host/touch_event_queue.h" 16 #include "content/browser/renderer_host/touch_event_queue.h"
17 #include "content/browser/renderer_host/touchpad_tap_suppression_controller.h"
18 #include "content/common/view_messages.h" 18 #include "content/common/view_messages.h"
19 #include "content/port/browser/render_widget_host_view_port.h" 19 #include "content/port/browser/render_widget_host_view_port.h"
20 #include "content/public/browser/notification_details.h" 20 #include "content/public/browser/notification_details.h"
21 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
23 #include "content/public/browser/notification_source.h" 23 #include "content/public/browser/notification_source.h"
24 #include "content/public/browser/notification_types.h" 24 #include "content/public/browser/notification_types.h"
25 #include "content/public/test/mock_render_process_host.h" 25 #include "content/public/test/mock_render_process_host.h"
26 #include "content/public/test/test_browser_context.h" 26 #include "content/public/test/test_browser_context.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 using RenderWidgetHostImpl::OnUpdateRect; 112 using RenderWidgetHostImpl::OnUpdateRect;
113 using RenderWidgetHostImpl::RendererExited; 113 using RenderWidgetHostImpl::RendererExited;
114 using RenderWidgetHostImpl::in_flight_size_; 114 using RenderWidgetHostImpl::in_flight_size_;
115 using RenderWidgetHostImpl::is_hidden_; 115 using RenderWidgetHostImpl::is_hidden_;
116 using RenderWidgetHostImpl::resize_ack_pending_; 116 using RenderWidgetHostImpl::resize_ack_pending_;
117 using RenderWidgetHostImpl::gesture_event_filter_; 117 using RenderWidgetHostImpl::gesture_event_filter_;
118 using RenderWidgetHostImpl::touch_event_queue_; 118 using RenderWidgetHostImpl::touch_event_queue_;
119 using RenderWidgetHostImpl::overscroll_controller_; 119 using RenderWidgetHostImpl::overscroll_controller_;
120 120
121 enum TapSuppressionState { 121 enum TapSuppressionState {
122 TSC_NOTHING = TapSuppressionController::NOTHING, 122 TSC_NOTHING = TouchpadTapSuppressionController::NOTHING,
123 TSC_GFC_IN_PROGRESS = TapSuppressionController::GFC_IN_PROGRESS, 123 TSC_GFC_IN_PROGRESS = TouchpadTapSuppressionController::GFC_IN_PROGRESS,
124 TSC_MD_STASHED = TapSuppressionController::MD_STASHED, 124 TSC_MD_STASHED = TouchpadTapSuppressionController::MD_STASHED,
125 TSC_LAST_CANCEL_STOPPED_FLING = 125 TSC_LAST_CANCEL_STOPPED_FLING =
126 TapSuppressionController::LAST_CANCEL_STOPPED_FLING, 126 TouchpadTapSuppressionController::LAST_CANCEL_STOPPED_FLING,
127 }; 127 };
128 128
129 bool unresponsive_timer_fired() const { 129 bool unresponsive_timer_fired() const {
130 return unresponsive_timer_fired_; 130 return unresponsive_timer_fired_;
131 } 131 }
132 132
133 void set_hung_renderer_delay_ms(int delay_ms) { 133 void set_hung_renderer_delay_ms(int delay_ms) {
134 hung_renderer_delay_ms_ = delay_ms; 134 hung_renderer_delay_ms_ = delay_ms;
135 } 135 }
136 136
(...skipping 20 matching lines...) Expand all
157 bool ScrollingInProgress() { 157 bool ScrollingInProgress() {
158 return gesture_event_filter_->scrolling_in_progress_; 158 return gesture_event_filter_->scrolling_in_progress_;
159 } 159 }
160 160
161 bool FlingInProgress() { 161 bool FlingInProgress() {
162 return gesture_event_filter_->fling_in_progress_; 162 return gesture_event_filter_->fling_in_progress_;
163 } 163 }
164 164
165 TapSuppressionState TapSuppressionControllerState() { 165 TapSuppressionState TapSuppressionControllerState() {
166 return static_cast<TapSuppressionState>( 166 return static_cast<TapSuppressionState>(
167 gesture_event_filter_->tap_suppression_controller_->state_); 167 gesture_event_filter_->touchpad_tap_suppression_controller_->state_);
168 } 168 }
169 169
170 void SetupForOverscrollControllerTest() { 170 void SetupForOverscrollControllerTest() {
171 InitializeOverscrollController(); 171 InitializeOverscrollController();
172 overscroll_delegate_.reset(new TestOverscrollDelegate); 172 overscroll_delegate_.reset(new TestOverscrollDelegate);
173 overscroll_controller_->set_delegate(overscroll_delegate_.get()); 173 overscroll_controller_->set_delegate(overscroll_delegate_.get());
174 } 174 }
175 175
176 void set_maximum_tap_gap_time_ms(int delay_ms) { 176 void set_maximum_tap_gap_time_ms(int delay_ms) {
177 gesture_event_filter_->maximum_tap_gap_time_ms_ = delay_ms; 177 gesture_event_filter_->maximum_tap_gap_time_ms_ = delay_ms;
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 WebInputEvent::GestureScrollUpdate}; 1580 WebInputEvent::GestureScrollUpdate};
1581 1581
1582 for (unsigned i = 0; i < sizeof(expected) / sizeof(WebInputEvent::Type); 1582 for (unsigned i = 0; i < sizeof(expected) / sizeof(WebInputEvent::Type);
1583 i++) { 1583 i++) {
1584 WebGestureEvent merged_event = host_->GestureEventQueueEventAt(i); 1584 WebGestureEvent merged_event = host_->GestureEventQueueEventAt(i);
1585 EXPECT_EQ(expected[i], merged_event.type); 1585 EXPECT_EQ(expected[i], merged_event.type);
1586 } 1586 }
1587 } 1587 }
1588 1588
1589 #if defined(USE_AURA) 1589 #if defined(USE_AURA)
1590 // Test TapSuppressionController for when GestureFlingCancel Ack comes before 1590 // Test TouchpadTapSuppressionController for when GestureFlingCancel Ack comes
1591 // MouseDown and everything happens without any delays. 1591 // before MouseDown and everything happens without any delays.
1592 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseFast) { 1592 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseFast) {
1593 process_->sink().ClearMessages(); 1593 process_->sink().ClearMessages();
1594 1594
1595 // Send GestureFlingStart. 1595 // Send GestureFlingStart.
1596 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 1596 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
1597 EXPECT_EQ(1U, process_->sink().message_count()); 1597 EXPECT_EQ(1U, process_->sink().message_count());
1598 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 1598 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
1599 EXPECT_EQ(WebInputEvent::GestureFlingStart, 1599 EXPECT_EQ(WebInputEvent::GestureFlingStart,
1600 host_->GestureEventLastQueueEvent().type); 1600 host_->GestureEventLastQueueEvent().type);
1601 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1601 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 1641
1642 // Send MouseUp. This MouseUp should be suppressed. 1642 // Send MouseUp. This MouseUp should be suppressed.
1643 SimulateMouseEvent(WebInputEvent::MouseUp); 1643 SimulateMouseEvent(WebInputEvent::MouseUp);
1644 EXPECT_EQ(2U, process_->sink().message_count()); 1644 EXPECT_EQ(2U, process_->sink().message_count());
1645 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 1645 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
1646 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1646 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
1647 host_->TapSuppressionControllerState()); 1647 host_->TapSuppressionControllerState());
1648 EXPECT_FALSE(host_->FlingInProgress()); 1648 EXPECT_FALSE(host_->FlingInProgress());
1649 } 1649 }
1650 1650
1651 // Test TapSuppressionController for when GestureFlingCancel Ack comes before 1651 // Test TouchpadTapSuppressionController for when GestureFlingCancel Ack comes
1652 // MouseDown, but there is a small delay between MouseDown and MouseUp. 1652 // before MouseDown, but there is a small delay between MouseDown and MouseUp.
1653 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseInsufficientlyLateMouseUp) { 1653 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseInsufficientlyLateMouseUp) {
1654 process_->sink().ClearMessages(); 1654 process_->sink().ClearMessages();
1655 1655
1656 // Send GestureFlingStart. 1656 // Send GestureFlingStart.
1657 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 1657 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
1658 EXPECT_EQ(1U, process_->sink().message_count()); 1658 EXPECT_EQ(1U, process_->sink().message_count());
1659 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 1659 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
1660 EXPECT_EQ(WebInputEvent::GestureFlingStart, 1660 EXPECT_EQ(WebInputEvent::GestureFlingStart,
1661 host_->GestureEventLastQueueEvent().type); 1661 host_->GestureEventLastQueueEvent().type);
1662 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1662 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 1717
1718 // Send MouseUp. This MouseUp should be suppressed. 1718 // Send MouseUp. This MouseUp should be suppressed.
1719 SimulateMouseEvent(WebInputEvent::MouseUp); 1719 SimulateMouseEvent(WebInputEvent::MouseUp);
1720 EXPECT_EQ(2U, process_->sink().message_count()); 1720 EXPECT_EQ(2U, process_->sink().message_count());
1721 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 1721 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
1722 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1722 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
1723 host_->TapSuppressionControllerState()); 1723 host_->TapSuppressionControllerState());
1724 EXPECT_FALSE(host_->FlingInProgress()); 1724 EXPECT_FALSE(host_->FlingInProgress());
1725 } 1725 }
1726 1726
1727 // Test TapSuppressionController for when GestureFlingCancel Ack comes before 1727 // Test TouchpadTapSuppressionController for when GestureFlingCancel Ack comes
1728 // MouseDown, but there is a long delay between MouseDown and MouseUp. 1728 // before MouseDown, but there is a long delay between MouseDown and MouseUp.
1729 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseSufficientlyLateMouseUp) { 1729 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseSufficientlyLateMouseUp) {
1730 process_->sink().ClearMessages(); 1730 process_->sink().ClearMessages();
1731 1731
1732 // Send GestureFlingStart. 1732 // Send GestureFlingStart.
1733 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 1733 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
1734 EXPECT_EQ(1U, process_->sink().message_count()); 1734 EXPECT_EQ(1U, process_->sink().message_count());
1735 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 1735 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
1736 EXPECT_EQ(WebInputEvent::GestureFlingStart, 1736 EXPECT_EQ(WebInputEvent::GestureFlingStart,
1737 host_->GestureEventLastQueueEvent().type); 1737 host_->GestureEventLastQueueEvent().type);
1738 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1738 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 1794
1795 // Send MouseUp. This MouseUp should not be suppressed. 1795 // Send MouseUp. This MouseUp should not be suppressed.
1796 SimulateMouseEvent(WebInputEvent::MouseUp); 1796 SimulateMouseEvent(WebInputEvent::MouseUp);
1797 EXPECT_EQ(4U, process_->sink().message_count()); 1797 EXPECT_EQ(4U, process_->sink().message_count());
1798 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 1798 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
1799 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1799 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
1800 host_->TapSuppressionControllerState()); 1800 host_->TapSuppressionControllerState());
1801 EXPECT_FALSE(host_->FlingInProgress()); 1801 EXPECT_FALSE(host_->FlingInProgress());
1802 } 1802 }
1803 1803
1804 // Test TapSuppressionController for when GestureFlingCancel Ack comes before 1804 // Test TouchpadTapSuppressionController for when GestureFlingCancel Ack comes
1805 // MouseDown, but there is a small delay between the Ack and MouseDown. 1805 // before MouseDown, but there is a small delay between the Ack and MouseDown.
1806 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseInsufficientlyLateMouseDown) { 1806 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseInsufficientlyLateMouseDown) {
1807 process_->sink().ClearMessages(); 1807 process_->sink().ClearMessages();
1808 1808
1809 // Send GestureFlingStart. 1809 // Send GestureFlingStart.
1810 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 1810 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
1811 EXPECT_EQ(1U, process_->sink().message_count()); 1811 EXPECT_EQ(1U, process_->sink().message_count());
1812 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 1812 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
1813 EXPECT_EQ(WebInputEvent::GestureFlingStart, 1813 EXPECT_EQ(WebInputEvent::GestureFlingStart,
1814 host_->GestureEventLastQueueEvent().type); 1814 host_->GestureEventLastQueueEvent().type);
1815 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1815 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 1871
1872 // Send MouseUp. This MouseUp should be suppressed. 1872 // Send MouseUp. This MouseUp should be suppressed.
1873 SimulateMouseEvent(WebInputEvent::MouseUp); 1873 SimulateMouseEvent(WebInputEvent::MouseUp);
1874 EXPECT_EQ(2U, process_->sink().message_count()); 1874 EXPECT_EQ(2U, process_->sink().message_count());
1875 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 1875 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
1876 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1876 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
1877 host_->TapSuppressionControllerState()); 1877 host_->TapSuppressionControllerState());
1878 EXPECT_FALSE(host_->FlingInProgress()); 1878 EXPECT_FALSE(host_->FlingInProgress());
1879 } 1879 }
1880 1880
1881 // Test TapSuppressionController for when GestureFlingCancel Ack comes before 1881 // Test TouchpadTapSuppressionController for when GestureFlingCancel Ack comes
1882 // MouseDown, but there is a long delay between the Ack and MouseDown. 1882 // before MouseDown, but there is a long delay between the Ack and MouseDown.
1883 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseSufficientlyLateMouseDown) { 1883 TEST_F(RenderWidgetHostTest, GFCAckBeforeMouseSufficientlyLateMouseDown) {
1884 process_->sink().ClearMessages(); 1884 process_->sink().ClearMessages();
1885 1885
1886 // Send GestureFlingStart. 1886 // Send GestureFlingStart.
1887 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 1887 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
1888 EXPECT_EQ(1U, process_->sink().message_count()); 1888 EXPECT_EQ(1U, process_->sink().message_count());
1889 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 1889 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
1890 EXPECT_EQ(WebInputEvent::GestureFlingStart, 1890 EXPECT_EQ(WebInputEvent::GestureFlingStart,
1891 host_->GestureEventLastQueueEvent().type); 1891 host_->GestureEventLastQueueEvent().type);
1892 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1892 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 1947
1948 // Send MouseUp. This MouseUp should not be suppressed. 1948 // Send MouseUp. This MouseUp should not be suppressed.
1949 SimulateMouseEvent(WebInputEvent::MouseUp); 1949 SimulateMouseEvent(WebInputEvent::MouseUp);
1950 EXPECT_EQ(4U, process_->sink().message_count()); 1950 EXPECT_EQ(4U, process_->sink().message_count());
1951 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 1951 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
1952 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1952 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
1953 host_->TapSuppressionControllerState()); 1953 host_->TapSuppressionControllerState());
1954 EXPECT_FALSE(host_->FlingInProgress()); 1954 EXPECT_FALSE(host_->FlingInProgress());
1955 } 1955 }
1956 1956
1957 // Test TapSuppressionController for when unprocessed GestureFlingCancel Ack 1957 // Test TouchpadTapSuppressionController for when unprocessed GestureFlingCancel
1958 // comes after MouseDown and everything happens without any delay. 1958 // Ack comes after MouseDown and everything happens without any delay.
1959 TEST_F(RenderWidgetHostTest, GFCAckUnprocessedAfterMouseFast) { 1959 TEST_F(RenderWidgetHostTest, GFCAckUnprocessedAfterMouseFast) {
1960 process_->sink().ClearMessages(); 1960 process_->sink().ClearMessages();
1961 1961
1962 // Send GestureFlingStart. 1962 // Send GestureFlingStart.
1963 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 1963 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
1964 EXPECT_EQ(1U, process_->sink().message_count()); 1964 EXPECT_EQ(1U, process_->sink().message_count());
1965 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 1965 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
1966 EXPECT_EQ(WebInputEvent::GestureFlingStart, 1966 EXPECT_EQ(WebInputEvent::GestureFlingStart,
1967 host_->GestureEventLastQueueEvent().type); 1967 host_->GestureEventLastQueueEvent().type);
1968 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 1968 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 2011
2012 // Send MouseUp. This MouseUp should not be suppressed. 2012 // Send MouseUp. This MouseUp should not be suppressed.
2013 SimulateMouseEvent(WebInputEvent::MouseUp); 2013 SimulateMouseEvent(WebInputEvent::MouseUp);
2014 EXPECT_EQ(4U, process_->sink().message_count()); 2014 EXPECT_EQ(4U, process_->sink().message_count());
2015 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 2015 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
2016 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 2016 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
2017 host_->TapSuppressionControllerState()); 2017 host_->TapSuppressionControllerState());
2018 EXPECT_FALSE(host_->FlingInProgress()); 2018 EXPECT_FALSE(host_->FlingInProgress());
2019 } 2019 }
2020 2020
2021 // Test TapSuppressionController for when processed GestureFlingCancel Ack 2021 // Test TouchpadTapSuppressionController for when processed GestureFlingCancel
2022 // comes after MouseDown and everything happens without any delay. 2022 // Ack comes after MouseDown and everything happens without any delay.
2023 TEST_F(RenderWidgetHostTest, GFCAckProcessedAfterMouseFast) { 2023 TEST_F(RenderWidgetHostTest, GFCAckProcessedAfterMouseFast) {
2024 process_->sink().ClearMessages(); 2024 process_->sink().ClearMessages();
2025 2025
2026 // Send GestureFlingStart. 2026 // Send GestureFlingStart.
2027 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 2027 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
2028 EXPECT_EQ(1U, process_->sink().message_count()); 2028 EXPECT_EQ(1U, process_->sink().message_count());
2029 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 2029 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
2030 EXPECT_EQ(WebInputEvent::GestureFlingStart, 2030 EXPECT_EQ(WebInputEvent::GestureFlingStart,
2031 host_->GestureEventLastQueueEvent().type); 2031 host_->GestureEventLastQueueEvent().type);
2032 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 2032 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 2074
2075 // Send MouseUp. This MouseUp should be suppressed. 2075 // Send MouseUp. This MouseUp should be suppressed.
2076 SimulateMouseEvent(WebInputEvent::MouseUp); 2076 SimulateMouseEvent(WebInputEvent::MouseUp);
2077 EXPECT_EQ(2U, process_->sink().message_count()); 2077 EXPECT_EQ(2U, process_->sink().message_count());
2078 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 2078 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
2079 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 2079 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
2080 host_->TapSuppressionControllerState()); 2080 host_->TapSuppressionControllerState());
2081 EXPECT_FALSE(host_->FlingInProgress()); 2081 EXPECT_FALSE(host_->FlingInProgress());
2082 } 2082 }
2083 2083
2084 // Test TapSuppressionController for when GestureFlingCancel Ack comes after 2084 // Test TouchpadTapSuppressionController for when GestureFlingCancel Ack comes
2085 // MouseDown and there is a small delay between the Ack and MouseUp. 2085 // after MouseDown and there is a small delay between the Ack and MouseUp.
2086 TEST_F(RenderWidgetHostTest, GFCAckAfterMouseInsufficientlyLateMouseUp) { 2086 TEST_F(RenderWidgetHostTest, GFCAckAfterMouseInsufficientlyLateMouseUp) {
2087 process_->sink().ClearMessages(); 2087 process_->sink().ClearMessages();
2088 2088
2089 // Send GestureFlingStart. 2089 // Send GestureFlingStart.
2090 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 2090 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
2091 EXPECT_EQ(1U, process_->sink().message_count()); 2091 EXPECT_EQ(1U, process_->sink().message_count());
2092 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 2092 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
2093 EXPECT_EQ(WebInputEvent::GestureFlingStart, 2093 EXPECT_EQ(WebInputEvent::GestureFlingStart,
2094 host_->GestureEventLastQueueEvent().type); 2094 host_->GestureEventLastQueueEvent().type);
2095 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 2095 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 2152
2153 // Send MouseUp. This MouseUp should be suppressed. 2153 // Send MouseUp. This MouseUp should be suppressed.
2154 SimulateMouseEvent(WebInputEvent::MouseUp); 2154 SimulateMouseEvent(WebInputEvent::MouseUp);
2155 EXPECT_EQ(2U, process_->sink().message_count()); 2155 EXPECT_EQ(2U, process_->sink().message_count());
2156 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 2156 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
2157 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 2157 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
2158 host_->TapSuppressionControllerState()); 2158 host_->TapSuppressionControllerState());
2159 EXPECT_FALSE(host_->FlingInProgress()); 2159 EXPECT_FALSE(host_->FlingInProgress());
2160 } 2160 }
2161 2161
2162 // Test TapSuppressionController for when GestureFlingCancel Ack comes after 2162 // Test TouchpadTapSuppressionController for when GestureFlingCancel Ack comes
2163 // MouseDown and there is a long delay between the Ack and MouseUp. 2163 // after MouseDown and there is a long delay between the Ack and MouseUp.
2164 TEST_F(RenderWidgetHostTest, GFCAckAfterMouseSufficientlyLateMouseUp) { 2164 TEST_F(RenderWidgetHostTest, GFCAckAfterMouseSufficientlyLateMouseUp) {
2165 process_->sink().ClearMessages(); 2165 process_->sink().ClearMessages();
2166 2166
2167 // Send GestureFlingStart. 2167 // Send GestureFlingStart.
2168 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad); 2168 SimulateGestureFlingStartEvent(0, -10, WebGestureEvent::Touchpad);
2169 EXPECT_EQ(1U, process_->sink().message_count()); 2169 EXPECT_EQ(1U, process_->sink().message_count());
2170 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 2170 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
2171 EXPECT_EQ(WebInputEvent::GestureFlingStart, 2171 EXPECT_EQ(WebInputEvent::GestureFlingStart,
2172 host_->GestureEventLastQueueEvent().type); 2172 host_->GestureEventLastQueueEvent().type);
2173 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING, 2173 EXPECT_EQ(MockRenderWidgetHost::TSC_NOTHING,
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); 3265 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
3266 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); 3266 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize());
3267 3267
3268 SendInputEventACK(WebKit::WebInputEvent::GestureScrollEnd, false); 3268 SendInputEventACK(WebKit::WebInputEvent::GestureScrollEnd, false);
3269 EXPECT_EQ(0U, process_->sink().message_count()); 3269 EXPECT_EQ(0U, process_->sink().message_count());
3270 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); 3270 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
3271 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); 3271 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize());
3272 } 3272 }
3273 3273
3274 } // namespace content 3274 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698