| 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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 // Use a custom timestamp for all the events to test that the acked events | 869 // Use a custom timestamp for all the events to test that the acked events |
| 870 // have the same timestamp; | 870 // have the same timestamp; |
| 871 base::TimeDelta timestamp = base::Time::NowFromSystemTime() - base::Time(); | 871 base::TimeDelta timestamp = base::Time::NowFromSystemTime() - base::Time(); |
| 872 timestamp -= base::TimeDelta::FromSeconds(600); | 872 timestamp -= base::TimeDelta::FromSeconds(600); |
| 873 | 873 |
| 874 // Press the first finger. | 874 // Press the first finger. |
| 875 PressTouchPoint(1, 1); | 875 PressTouchPoint(1, 1); |
| 876 SetTouchTimestamp(timestamp); | 876 SetTouchTimestamp(timestamp); |
| 877 uint32 touch_press_event_id1 = SendTouchEvent(); | 877 uint32 touch_press_event_id1 = SendTouchEvent(); |
| 878 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 878 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 879 expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, | 879 expected_events.push_back(new ui::TouchEvent( |
| 880 gfx::Point(1, 1), 0, timestamp)); | 880 ui::ET_TOUCH_PRESSED, gfx::PointF(1.f, 1.f), 0, timestamp)); |
| 881 | 881 |
| 882 // Move the finger. | 882 // Move the finger. |
| 883 timestamp += base::TimeDelta::FromSeconds(10); | 883 timestamp += base::TimeDelta::FromSeconds(10); |
| 884 MoveTouchPoint(0, 500, 500); | 884 MoveTouchPoint(0, 500, 500); |
| 885 SetTouchTimestamp(timestamp); | 885 SetTouchTimestamp(timestamp); |
| 886 uint32 touch_move_event_id1 = SendTouchEvent(); | 886 uint32 touch_move_event_id1 = SendTouchEvent(); |
| 887 EXPECT_FALSE(TouchEventQueueEmpty()); | 887 EXPECT_FALSE(TouchEventQueueEmpty()); |
| 888 expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_MOVED, | 888 expected_events.push_back(new ui::TouchEvent( |
| 889 gfx::Point(500, 500), 0, timestamp)); | 889 ui::ET_TOUCH_MOVED, gfx::PointF(500.f, 500.f), 0, timestamp)); |
| 890 | 890 |
| 891 // Now press a second finger. | 891 // Now press a second finger. |
| 892 timestamp += base::TimeDelta::FromSeconds(10); | 892 timestamp += base::TimeDelta::FromSeconds(10); |
| 893 PressTouchPoint(2, 2); | 893 PressTouchPoint(2, 2); |
| 894 SetTouchTimestamp(timestamp); | 894 SetTouchTimestamp(timestamp); |
| 895 uint32 touch_press_event_id2 = SendTouchEvent(); | 895 uint32 touch_press_event_id2 = SendTouchEvent(); |
| 896 EXPECT_FALSE(TouchEventQueueEmpty()); | 896 EXPECT_FALSE(TouchEventQueueEmpty()); |
| 897 expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, | 897 expected_events.push_back(new ui::TouchEvent( |
| 898 gfx::Point(2, 2), 1, timestamp)); | 898 ui::ET_TOUCH_PRESSED, gfx::PointF(2.f, 2.f), 1, timestamp)); |
| 899 | 899 |
| 900 // Move both fingers. | 900 // Move both fingers. |
| 901 timestamp += base::TimeDelta::FromSeconds(10); | 901 timestamp += base::TimeDelta::FromSeconds(10); |
| 902 MoveTouchPoint(0, 10, 10); | 902 MoveTouchPoint(0, 10, 10); |
| 903 MoveTouchPoint(1, 20, 20); | 903 MoveTouchPoint(1, 20, 20); |
| 904 SetTouchTimestamp(timestamp); | 904 SetTouchTimestamp(timestamp); |
| 905 uint32 touch_move_event_id2 = SendTouchEvent(); | 905 uint32 touch_move_event_id2 = SendTouchEvent(); |
| 906 EXPECT_FALSE(TouchEventQueueEmpty()); | 906 EXPECT_FALSE(TouchEventQueueEmpty()); |
| 907 expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_MOVED, | 907 expected_events.push_back(new ui::TouchEvent( |
| 908 gfx::Point(10, 10), 0, timestamp)); | 908 ui::ET_TOUCH_MOVED, gfx::PointF(10.f, 10.f), 0, timestamp)); |
| 909 expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_MOVED, | 909 expected_events.push_back(new ui::TouchEvent( |
| 910 gfx::Point(20, 20), 1, timestamp)); | 910 ui::ET_TOUCH_MOVED, gfx::PointF(20.f, 20.f), 1, timestamp)); |
| 911 | 911 |
| 912 // Receive the ACKs and make sure the generated events from the acked events | 912 // Receive the ACKs and make sure the generated events from the acked events |
| 913 // are correct. | 913 // are correct. |
| 914 WebInputEvent::Type acks[] = { WebInputEvent::TouchStart, | 914 WebInputEvent::Type acks[] = { WebInputEvent::TouchStart, |
| 915 WebInputEvent::TouchMove, | 915 WebInputEvent::TouchMove, |
| 916 WebInputEvent::TouchStart, | 916 WebInputEvent::TouchStart, |
| 917 WebInputEvent::TouchMove }; | 917 WebInputEvent::TouchMove }; |
| 918 | 918 |
| 919 uint32 touch_event_ids[] = {touch_press_event_id1, | 919 uint32 touch_event_ids[] = {touch_press_event_id1, |
| 920 touch_move_event_id1, | 920 touch_move_event_id1, |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 client_overscroll = client_->GetAndResetOverscroll(); | 1829 client_overscroll = client_->GetAndResetOverscroll(); |
| 1830 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, | 1830 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, |
| 1831 client_overscroll.accumulated_overscroll); | 1831 client_overscroll.accumulated_overscroll); |
| 1832 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, | 1832 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, |
| 1833 client_overscroll.latest_overscroll_delta); | 1833 client_overscroll.latest_overscroll_delta); |
| 1834 EXPECT_EQ(wheel_overscroll.current_fling_velocity, | 1834 EXPECT_EQ(wheel_overscroll.current_fling_velocity, |
| 1835 client_overscroll.current_fling_velocity); | 1835 client_overscroll.current_fling_velocity); |
| 1836 } | 1836 } |
| 1837 | 1837 |
| 1838 } // namespace content | 1838 } // namespace content |
| OLD | NEW |