| 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 // Use a custom timestamp for all the events to test that the acked events | 851 // Use a custom timestamp for all the events to test that the acked events |
| 852 // have the same timestamp; | 852 // have the same timestamp; |
| 853 base::TimeDelta timestamp = base::Time::NowFromSystemTime() - base::Time(); | 853 base::TimeDelta timestamp = base::Time::NowFromSystemTime() - base::Time(); |
| 854 timestamp -= base::TimeDelta::FromSeconds(600); | 854 timestamp -= base::TimeDelta::FromSeconds(600); |
| 855 | 855 |
| 856 // Press the first finger. | 856 // Press the first finger. |
| 857 PressTouchPoint(1, 1); | 857 PressTouchPoint(1, 1); |
| 858 SetTouchTimestamp(timestamp); | 858 SetTouchTimestamp(timestamp); |
| 859 uint32 touch_press_event_id1 = SendTouchEvent(); | 859 uint32 touch_press_event_id1 = SendTouchEvent(); |
| 860 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 860 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 861 expected_events.push_back(new ui::TouchEvent( | 861 expected_events.push_back( |
| 862 ui::ET_TOUCH_PRESSED, gfx::PointF(1.f, 1.f), 0, timestamp)); | 862 new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), 0, timestamp)); |
| 863 | 863 |
| 864 // Move the finger. | 864 // Move the finger. |
| 865 timestamp += base::TimeDelta::FromSeconds(10); | 865 timestamp += base::TimeDelta::FromSeconds(10); |
| 866 MoveTouchPoint(0, 500, 500); | 866 MoveTouchPoint(0, 500, 500); |
| 867 SetTouchTimestamp(timestamp); | 867 SetTouchTimestamp(timestamp); |
| 868 uint32 touch_move_event_id1 = SendTouchEvent(); | 868 uint32 touch_move_event_id1 = SendTouchEvent(); |
| 869 EXPECT_FALSE(TouchEventQueueEmpty()); | 869 EXPECT_FALSE(TouchEventQueueEmpty()); |
| 870 expected_events.push_back(new ui::TouchEvent( | 870 expected_events.push_back(new ui::TouchEvent( |
| 871 ui::ET_TOUCH_MOVED, gfx::PointF(500.f, 500.f), 0, timestamp)); | 871 ui::ET_TOUCH_MOVED, gfx::Point(500, 500), 0, timestamp)); |
| 872 | 872 |
| 873 // Now press a second finger. | 873 // Now press a second finger. |
| 874 timestamp += base::TimeDelta::FromSeconds(10); | 874 timestamp += base::TimeDelta::FromSeconds(10); |
| 875 PressTouchPoint(2, 2); | 875 PressTouchPoint(2, 2); |
| 876 SetTouchTimestamp(timestamp); | 876 SetTouchTimestamp(timestamp); |
| 877 uint32 touch_press_event_id2 = SendTouchEvent(); | 877 uint32 touch_press_event_id2 = SendTouchEvent(); |
| 878 EXPECT_FALSE(TouchEventQueueEmpty()); | 878 EXPECT_FALSE(TouchEventQueueEmpty()); |
| 879 expected_events.push_back(new ui::TouchEvent( | 879 expected_events.push_back( |
| 880 ui::ET_TOUCH_PRESSED, gfx::PointF(2.f, 2.f), 1, timestamp)); | 880 new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(2, 2), 1, timestamp)); |
| 881 | 881 |
| 882 // Move both fingers. | 882 // Move both fingers. |
| 883 timestamp += base::TimeDelta::FromSeconds(10); | 883 timestamp += base::TimeDelta::FromSeconds(10); |
| 884 MoveTouchPoint(0, 10, 10); | 884 MoveTouchPoint(0, 10, 10); |
| 885 MoveTouchPoint(1, 20, 20); | 885 MoveTouchPoint(1, 20, 20); |
| 886 SetTouchTimestamp(timestamp); | 886 SetTouchTimestamp(timestamp); |
| 887 uint32 touch_move_event_id2 = SendTouchEvent(); | 887 uint32 touch_move_event_id2 = SendTouchEvent(); |
| 888 EXPECT_FALSE(TouchEventQueueEmpty()); | 888 EXPECT_FALSE(TouchEventQueueEmpty()); |
| 889 expected_events.push_back(new ui::TouchEvent( | 889 expected_events.push_back( |
| 890 ui::ET_TOUCH_MOVED, gfx::PointF(10.f, 10.f), 0, timestamp)); | 890 new ui::TouchEvent(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 0, timestamp)); |
| 891 expected_events.push_back(new ui::TouchEvent( | 891 expected_events.push_back( |
| 892 ui::ET_TOUCH_MOVED, gfx::PointF(20.f, 20.f), 1, timestamp)); | 892 new ui::TouchEvent(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 1, timestamp)); |
| 893 | 893 |
| 894 // Receive the ACKs and make sure the generated events from the acked events | 894 // Receive the ACKs and make sure the generated events from the acked events |
| 895 // are correct. | 895 // are correct. |
| 896 WebInputEvent::Type acks[] = { WebInputEvent::TouchStart, | 896 WebInputEvent::Type acks[] = { WebInputEvent::TouchStart, |
| 897 WebInputEvent::TouchMove, | 897 WebInputEvent::TouchMove, |
| 898 WebInputEvent::TouchStart, | 898 WebInputEvent::TouchStart, |
| 899 WebInputEvent::TouchMove }; | 899 WebInputEvent::TouchMove }; |
| 900 | 900 |
| 901 uint32 touch_event_ids[] = {touch_press_event_id1, | 901 uint32 touch_event_ids[] = {touch_press_event_id1, |
| 902 touch_move_event_id1, | 902 touch_move_event_id1, |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 client_overscroll = client_->GetAndResetOverscroll(); | 1811 client_overscroll = client_->GetAndResetOverscroll(); |
| 1812 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, | 1812 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, |
| 1813 client_overscroll.accumulated_overscroll); | 1813 client_overscroll.accumulated_overscroll); |
| 1814 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, | 1814 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, |
| 1815 client_overscroll.latest_overscroll_delta); | 1815 client_overscroll.latest_overscroll_delta); |
| 1816 EXPECT_EQ(wheel_overscroll.current_fling_velocity, | 1816 EXPECT_EQ(wheel_overscroll.current_fling_velocity, |
| 1817 client_overscroll.current_fling_velocity); | 1817 client_overscroll.current_fling_velocity); |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 } // namespace content | 1820 } // namespace content |
| OLD | NEW |