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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 void SetTouchTimestamp(base::TimeDelta timestamp) { | 246 void SetTouchTimestamp(base::TimeDelta timestamp) { |
247 touch_event_.SetTimestamp(timestamp); | 247 touch_event_.SetTimestamp(timestamp); |
248 } | 248 } |
249 | 249 |
250 void SendTouchEvent() { | 250 void SendTouchEvent() { |
251 input_router_->SendTouchEvent(TouchEventWithLatencyInfo(touch_event_)); | 251 input_router_->SendTouchEvent(TouchEventWithLatencyInfo(touch_event_)); |
252 touch_event_.ResetPoints(); | 252 touch_event_.ResetPoints(); |
253 } | 253 } |
254 | 254 |
255 int PressTouchPoint(int x, int y) { | 255 int PressTouchPoint(int x, int y) { |
256 LOG(ERROR) << " PressTouchPoint " << touch_event_.uniqueTouchEventId; | |
tdresser
2015/04/08 12:24:26
These logs should be removed.
lanwei
2015/04/09 04:14:28
Done.
| |
256 return touch_event_.PressPoint(x, y); | 257 return touch_event_.PressPoint(x, y); |
257 } | 258 } |
258 | 259 |
259 void MoveTouchPoint(int index, int x, int y) { | 260 void MoveTouchPoint(int index, int x, int y) { |
260 touch_event_.MovePoint(index, x, y); | 261 touch_event_.MovePoint(index, x, y); |
261 } | 262 } |
262 | 263 |
263 void ReleaseTouchPoint(int index) { | 264 void ReleaseTouchPoint(int index) { |
264 touch_event_.ReleasePoint(index); | 265 touch_event_.ReleasePoint(index); |
265 } | 266 } |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
855 // Send a bunch of events, and make sure the ACKed events are correct. | 856 // Send a bunch of events, and make sure the ACKed events are correct. |
856 ScopedVector<ui::TouchEvent> expected_events; | 857 ScopedVector<ui::TouchEvent> expected_events; |
857 | 858 |
858 // Use a custom timestamp for all the events to test that the acked events | 859 // Use a custom timestamp for all the events to test that the acked events |
859 // have the same timestamp; | 860 // have the same timestamp; |
860 base::TimeDelta timestamp = base::Time::NowFromSystemTime() - base::Time(); | 861 base::TimeDelta timestamp = base::Time::NowFromSystemTime() - base::Time(); |
861 timestamp -= base::TimeDelta::FromSeconds(600); | 862 timestamp -= base::TimeDelta::FromSeconds(600); |
862 | 863 |
863 // Press the first finger. | 864 // Press the first finger. |
864 PressTouchPoint(1, 1); | 865 PressTouchPoint(1, 1); |
866 LOG(ERROR) << " InputRouterImplTest.AckedTouchEventState "; | |
tdresser
2015/04/08 12:24:26
Ditto.
lanwei
2015/04/09 04:14:28
Done.
| |
865 SetTouchTimestamp(timestamp); | 867 SetTouchTimestamp(timestamp); |
866 SendTouchEvent(); | 868 SendTouchEvent(); |
867 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 869 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
868 expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, | 870 expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, |
869 gfx::Point(1, 1), 0, timestamp)); | 871 gfx::Point(1, 1), 0, timestamp)); |
870 | 872 |
871 // Move the finger. | 873 // Move the finger. |
872 timestamp += base::TimeDelta::FromSeconds(10); | 874 timestamp += base::TimeDelta::FromSeconds(10); |
873 MoveTouchPoint(0, 500, 500); | 875 MoveTouchPoint(0, 500, 500); |
874 SetTouchTimestamp(timestamp); | 876 SetTouchTimestamp(timestamp); |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1794 client_overscroll = client_->GetAndResetOverscroll(); | 1796 client_overscroll = client_->GetAndResetOverscroll(); |
1795 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, | 1797 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, |
1796 client_overscroll.accumulated_overscroll); | 1798 client_overscroll.accumulated_overscroll); |
1797 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, | 1799 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, |
1798 client_overscroll.latest_overscroll_delta); | 1800 client_overscroll.latest_overscroll_delta); |
1799 EXPECT_EQ(wheel_overscroll.current_fling_velocity, | 1801 EXPECT_EQ(wheel_overscroll.current_fling_velocity, |
1800 client_overscroll.current_fling_velocity); | 1802 client_overscroll.current_fling_velocity); |
1801 } | 1803 } |
1802 | 1804 |
1803 } // namespace content | 1805 } // namespace content |
OLD | NEW |