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 <math.h> | 5 #include <math.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 blink::WebGestureDeviceTouchpad); | 1752 blink::WebGestureDeviceTouchpad); |
1753 ASSERT_EQ(0U, GetSentMessageCountAndResetSink()); | 1753 ASSERT_EQ(0U, GetSentMessageCountAndResetSink()); |
1754 EXPECT_EQ(1, client_->in_flight_event_count()); | 1754 EXPECT_EQ(1, client_->in_flight_event_count()); |
1755 | 1755 |
1756 SimulateGestureScrollUpdateEvent(0.f, 1.5f, 0, | 1756 SimulateGestureScrollUpdateEvent(0.f, 1.5f, 0, |
1757 blink::WebGestureDeviceTouchpad); | 1757 blink::WebGestureDeviceTouchpad); |
1758 ASSERT_EQ(0U, GetSentMessageCountAndResetSink()); | 1758 ASSERT_EQ(0U, GetSentMessageCountAndResetSink()); |
1759 EXPECT_EQ(1, client_->in_flight_event_count()); | 1759 EXPECT_EQ(1, client_->in_flight_event_count()); |
1760 | 1760 |
1761 // Ack'ing the first scroll should trigger both the coalesced scroll and the | 1761 // Ack'ing the first scroll should trigger both the coalesced scroll and the |
1762 // coalesced pinch events (which is sent to the renderer as a wheel event). | 1762 // coalesced pinch events. |
1763 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 1763 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
1764 INPUT_EVENT_ACK_STATE_CONSUMED); | 1764 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 1765 EXPECT_EQ(WebInputEvent::GestureScrollUpdate, ack_handler_->ack_event_type()); |
1765 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); | 1766 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
1766 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); | 1767 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
1767 EXPECT_EQ(2, client_->in_flight_event_count()); | 1768 EXPECT_EQ(2, client_->in_flight_event_count()); |
1768 | 1769 |
1769 // Ack the second scroll. | 1770 // Ack the second scroll. |
1770 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 1771 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
1771 INPUT_EVENT_ACK_STATE_CONSUMED); | 1772 INPUT_EVENT_ACK_STATE_CONSUMED); |
1772 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); | 1773 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1774 EXPECT_EQ(WebInputEvent::GestureScrollUpdate, ack_handler_->ack_event_type()); |
1773 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); | 1775 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
1774 EXPECT_EQ(1, client_->in_flight_event_count()); | 1776 EXPECT_EQ(1, client_->in_flight_event_count()); |
1775 | 1777 |
1776 // Ack the wheel event. | 1778 // Ack the wheel event. |
1777 SendInputEventACK(WebInputEvent::MouseWheel, INPUT_EVENT_ACK_STATE_CONSUMED); | 1779 SendInputEventACK(WebInputEvent::GesturePinchUpdate, |
| 1780 INPUT_EVENT_ACK_STATE_CONSUMED); |
1778 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); | 1781 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1782 EXPECT_EQ(WebInputEvent::GesturePinchUpdate, ack_handler_->ack_event_type()); |
1779 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); | 1783 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
1780 EXPECT_EQ(0, client_->in_flight_event_count()); | 1784 EXPECT_EQ(0, client_->in_flight_event_count()); |
1781 } | 1785 } |
1782 | 1786 |
1783 // Test proper routing of overscroll notifications received either from | 1787 // Test proper routing of overscroll notifications received either from |
1784 // event acks or from |DidOverscroll| IPC messages. | 1788 // event acks or from |DidOverscroll| IPC messages. |
1785 TEST_F(InputRouterImplTest, OverscrollDispatch) { | 1789 TEST_F(InputRouterImplTest, OverscrollDispatch) { |
1786 DidOverscrollParams overscroll; | 1790 DidOverscrollParams overscroll; |
1787 overscroll.accumulated_overscroll = gfx::Vector2dF(-14, 14); | 1791 overscroll.accumulated_overscroll = gfx::Vector2dF(-14, 14); |
1788 overscroll.latest_overscroll_delta = gfx::Vector2dF(-7, 0); | 1792 overscroll.latest_overscroll_delta = gfx::Vector2dF(-7, 0); |
(...skipping 22 matching lines...) Expand all Loading... |
1811 client_overscroll = client_->GetAndResetOverscroll(); | 1815 client_overscroll = client_->GetAndResetOverscroll(); |
1812 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, | 1816 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, |
1813 client_overscroll.accumulated_overscroll); | 1817 client_overscroll.accumulated_overscroll); |
1814 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, | 1818 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, |
1815 client_overscroll.latest_overscroll_delta); | 1819 client_overscroll.latest_overscroll_delta); |
1816 EXPECT_EQ(wheel_overscroll.current_fling_velocity, | 1820 EXPECT_EQ(wheel_overscroll.current_fling_velocity, |
1817 client_overscroll.current_fling_velocity); | 1821 client_overscroll.current_fling_velocity); |
1818 } | 1822 } |
1819 | 1823 |
1820 } // namespace content | 1824 } // namespace content |
OLD | NEW |