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/mock_motion_event.h" | 10 #include "ui/events/test/mock_motion_event.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 ASSERT_EQ(a.GetPointerCount(), b.GetPointerCount()); | 90 ASSERT_EQ(a.GetPointerCount(), b.GetPointerCount()); |
91 for (size_t i = 0; i < a.GetPointerCount(); ++i) { | 91 for (size_t i = 0; i < a.GetPointerCount(); ++i) { |
92 int bi = b.FindPointerIndexOfId(a.GetPointerId(i)); | 92 int bi = b.FindPointerIndexOfId(a.GetPointerId(i)); |
93 ASSERT_NE(bi, -1); | 93 ASSERT_NE(bi, -1); |
94 EXPECT_EQ(a.GetX(i), b.GetX(bi)); | 94 EXPECT_EQ(a.GetX(i), b.GetX(bi)); |
95 EXPECT_EQ(a.GetY(i), b.GetY(bi)); | 95 EXPECT_EQ(a.GetY(i), b.GetY(bi)); |
96 EXPECT_EQ(a.GetRawX(i), b.GetRawX(bi)); | 96 EXPECT_EQ(a.GetRawX(i), b.GetRawX(bi)); |
97 EXPECT_EQ(a.GetRawY(i), b.GetRawY(bi)); | 97 EXPECT_EQ(a.GetRawY(i), b.GetRawY(bi)); |
98 EXPECT_EQ(a.GetTouchMajor(i), b.GetTouchMajor(bi)); | 98 EXPECT_EQ(a.GetTouchMajor(i), b.GetTouchMajor(bi)); |
| 99 EXPECT_EQ(a.GetTouchMinor(i), b.GetTouchMinor(bi)); |
| 100 EXPECT_EQ(a.GetOrientation(i), b.GetOrientation(bi)); |
99 EXPECT_EQ(a.GetPressure(i), b.GetPressure(bi)); | 101 EXPECT_EQ(a.GetPressure(i), b.GetPressure(bi)); |
100 EXPECT_EQ(a.GetToolType(i), b.GetToolType(bi)); | 102 EXPECT_EQ(a.GetToolType(i), b.GetToolType(bi)); |
101 } | 103 } |
102 | 104 |
103 if (ignore_history) | 105 if (ignore_history) |
104 return; | 106 return; |
105 | 107 |
106 ASSERT_EQ(a.GetHistorySize(), b.GetHistorySize()); | 108 ASSERT_EQ(a.GetHistorySize(), b.GetHistorySize()); |
107 for (size_t h = 0; h < a.GetHistorySize(); ++h) | 109 for (size_t h = 0; h < a.GetHistorySize(); ++h) |
108 ExpectEqualsHistoryIndex(a, h, b); | 110 ExpectEqualsHistoryIndex(a, h, b); |
(...skipping 21 matching lines...) Expand all Loading... |
130 EXPECT_EQ(a.GetPointerCount(), b.GetPointerCount()); | 132 EXPECT_EQ(a.GetPointerCount(), b.GetPointerCount()); |
131 EXPECT_TRUE(a.GetHistoricalEventTime(history_index) == b.GetEventTime()); | 133 EXPECT_TRUE(a.GetHistoricalEventTime(history_index) == b.GetEventTime()); |
132 | 134 |
133 for (size_t i = 0; i < a.GetPointerCount(); ++i) { | 135 for (size_t i = 0; i < a.GetPointerCount(); ++i) { |
134 int bi = b.FindPointerIndexOfId(a.GetPointerId(i)); | 136 int bi = b.FindPointerIndexOfId(a.GetPointerId(i)); |
135 ASSERT_NE(bi, -1); | 137 ASSERT_NE(bi, -1); |
136 EXPECT_EQ(a.GetHistoricalX(i, history_index), b.GetX(bi)); | 138 EXPECT_EQ(a.GetHistoricalX(i, history_index), b.GetX(bi)); |
137 EXPECT_EQ(a.GetHistoricalY(i, history_index), b.GetY(bi)); | 139 EXPECT_EQ(a.GetHistoricalY(i, history_index), b.GetY(bi)); |
138 EXPECT_EQ(a.GetHistoricalTouchMajor(i, history_index), | 140 EXPECT_EQ(a.GetHistoricalTouchMajor(i, history_index), |
139 b.GetTouchMajor(bi)); | 141 b.GetTouchMajor(bi)); |
| 142 EXPECT_EQ(a.GetHistoricalTouchMinor(i, history_index), |
| 143 b.GetTouchMinor(bi)); |
| 144 EXPECT_EQ(a.GetHistoricalOrientation(i, history_index), |
| 145 b.GetOrientation(bi)); |
140 } | 146 } |
141 } | 147 } |
142 | 148 |
143 protected: | 149 protected: |
144 void RunResample(base::TimeDelta flush_time_delta, | 150 void RunResample(base::TimeDelta flush_time_delta, |
145 base::TimeDelta event_time_delta) { | 151 base::TimeDelta event_time_delta) { |
146 for (base::TimeDelta offset; offset < event_time_delta; | 152 for (base::TimeDelta offset; offset < event_time_delta; |
147 offset += event_time_delta / 3) { | 153 offset += event_time_delta / 3) { |
148 SCOPED_TRACE(testing::Message() | 154 SCOPED_TRACE(testing::Message() |
149 << "Resample(offset=" | 155 << "Resample(offset=" |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 TEST_F(MotionEventBufferTest, Resampling150to60) { | 866 TEST_F(MotionEventBufferTest, Resampling150to60) { |
861 base::TimeDelta flush_time_delta = | 867 base::TimeDelta flush_time_delta = |
862 base::TimeDelta::FromMillisecondsD(1000. / 60.); | 868 base::TimeDelta::FromMillisecondsD(1000. / 60.); |
863 base::TimeDelta event_time_delta = | 869 base::TimeDelta event_time_delta = |
864 base::TimeDelta::FromMillisecondsD(1000. / 150.); | 870 base::TimeDelta::FromMillisecondsD(1000. / 150.); |
865 | 871 |
866 RunResample(flush_time_delta, event_time_delta); | 872 RunResample(flush_time_delta, event_time_delta); |
867 } | 873 } |
868 | 874 |
869 } // namespace ui | 875 } // namespace ui |
OLD | NEW |