| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/events/gesture_detection/motion_event_buffer.h" | 9 #include "ui/events/gesture_detection/motion_event_buffer.h" |
| 10 #include "ui/events/test/motion_event_test_utils.h" | 10 #include "ui/events/test/motion_event_test_utils.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 return base::TimeDelta::FromMilliseconds(kSmallDeltaMs); | 74 return base::TimeDelta::FromMilliseconds(kSmallDeltaMs); |
| 75 } | 75 } |
| 76 | 76 |
| 77 static base::TimeDelta ResampleDelta() { | 77 static base::TimeDelta ResampleDelta() { |
| 78 return base::TimeDelta::FromMilliseconds(kResampleDeltaMs); | 78 return base::TimeDelta::FromMilliseconds(kResampleDeltaMs); |
| 79 } | 79 } |
| 80 | 80 |
| 81 static void ExpectEqualsImpl(const MotionEvent& a, | 81 static void ExpectEqualsImpl(const MotionEvent& a, |
| 82 const MotionEvent& b, | 82 const MotionEvent& b, |
| 83 bool ignore_history) { | 83 bool ignore_history) { |
| 84 EXPECT_EQ(a.GetId(), b.GetId()); | |
| 85 EXPECT_EQ(a.GetAction(), b.GetAction()); | 84 EXPECT_EQ(a.GetAction(), b.GetAction()); |
| 86 if (a.GetAction() == MotionEvent::ACTION_POINTER_DOWN || | 85 if (a.GetAction() == MotionEvent::ACTION_POINTER_DOWN || |
| 87 a.GetAction() == MotionEvent::ACTION_POINTER_UP) { | 86 a.GetAction() == MotionEvent::ACTION_POINTER_UP) { |
| 88 EXPECT_EQ(a.GetActionIndex(), b.GetActionIndex()); | 87 EXPECT_EQ(a.GetActionIndex(), b.GetActionIndex()); |
| 89 } | 88 } |
| 90 EXPECT_EQ(a.GetButtonState(), b.GetButtonState()); | 89 EXPECT_EQ(a.GetButtonState(), b.GetButtonState()); |
| 91 EXPECT_EQ(a.GetEventTime(), b.GetEventTime()); | 90 EXPECT_EQ(a.GetEventTime(), b.GetEventTime()); |
| 92 | 91 |
| 93 ASSERT_EQ(a.GetPointerCount(), b.GetPointerCount()); | 92 ASSERT_EQ(a.GetPointerCount(), b.GetPointerCount()); |
| 94 for (size_t i = 0; i < a.GetPointerCount(); ++i) { | 93 for (size_t i = 0; i < a.GetPointerCount(); ++i) { |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 TEST_F(MotionEventBufferTest, Resampling150to60) { | 864 TEST_F(MotionEventBufferTest, Resampling150to60) { |
| 866 base::TimeDelta flush_time_delta = | 865 base::TimeDelta flush_time_delta = |
| 867 base::TimeDelta::FromMillisecondsD(1000. / 60.); | 866 base::TimeDelta::FromMillisecondsD(1000. / 60.); |
| 868 base::TimeDelta event_time_delta = | 867 base::TimeDelta event_time_delta = |
| 869 base::TimeDelta::FromMillisecondsD(1000. / 150.); | 868 base::TimeDelta::FromMillisecondsD(1000. / 150.); |
| 870 | 869 |
| 871 RunResample(flush_time_delta, event_time_delta); | 870 RunResample(flush_time_delta, event_time_delta); |
| 872 } | 871 } |
| 873 | 872 |
| 874 } // namespace ui | 873 } // namespace ui |
| OLD | NEW |