| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/common/input/event_with_latency_info.h" | 5 #include "content/common/input/event_with_latency_info.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 10 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ASSERT_TRUE(scroll_0.CanCoalesceWith(scroll_1)); | 103 ASSERT_TRUE(scroll_0.CanCoalesceWith(scroll_1)); |
| 104 scroll_0.CoalesceWith(scroll_1); | 104 scroll_0.CoalesceWith(scroll_1); |
| 105 // Coalescing WebGestureEvent preserves newer timestamp. | 105 // Coalescing WebGestureEvent preserves newer timestamp. |
| 106 EXPECT_EQ(10.0, scroll_0.event.TimeStampSeconds()); | 106 EXPECT_EQ(10.0, scroll_0.event.TimeStampSeconds()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 TEST_F(EventWithLatencyInfoTest, LatencyInfoCoalescing) { | 109 TEST_F(EventWithLatencyInfoTest, LatencyInfoCoalescing) { |
| 110 MouseEventWithLatencyInfo mouse_0 = | 110 MouseEventWithLatencyInfo mouse_0 = |
| 111 CreateMouseEvent(WebInputEvent::kMouseMove, 5.0); | 111 CreateMouseEvent(WebInputEvent::kMouseMove, 5.0); |
| 112 mouse_0.latency.AddLatencyNumberWithTimestamp( | 112 mouse_0.latency.AddLatencyNumberWithTimestamp( |
| 113 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, base::TimeTicks(), 1); | 113 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, base::TimeTicks(), 1); |
| 114 MouseEventWithLatencyInfo mouse_1 = | 114 MouseEventWithLatencyInfo mouse_1 = |
| 115 CreateMouseEvent(WebInputEvent::kMouseMove, 10.0); | 115 CreateMouseEvent(WebInputEvent::kMouseMove, 10.0); |
| 116 | 116 |
| 117 ASSERT_TRUE(mouse_0.CanCoalesceWith(mouse_1)); | 117 ASSERT_TRUE(mouse_0.CanCoalesceWith(mouse_1)); |
| 118 | 118 |
| 119 ui::LatencyInfo::LatencyComponent component; | 119 ui::LatencyInfo::LatencyComponent component; |
| 120 EXPECT_FALSE(mouse_1.latency.FindLatency( | 120 EXPECT_FALSE(mouse_1.latency.FindLatency( |
| 121 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, &component)); | 121 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, &component)); |
| 122 | 122 |
| 123 mouse_0.CoalesceWith(mouse_1); | 123 mouse_0.CoalesceWith(mouse_1); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 MouseWheelEventWithLatencyInfo mouse_wheel_1 = | 359 MouseWheelEventWithLatencyInfo mouse_wheel_1 = |
| 360 CreateMouseWheelEvent(10.0, 2, 2); | 360 CreateMouseWheelEvent(10.0, 2, 2); |
| 361 | 361 |
| 362 EXPECT_TRUE(CanCoalesce(mouse_wheel_0, mouse_wheel_1)); | 362 EXPECT_TRUE(CanCoalesce(mouse_wheel_0, mouse_wheel_1)); |
| 363 Coalesce(mouse_wheel_1, &mouse_wheel_0); | 363 Coalesce(mouse_wheel_1, &mouse_wheel_0); |
| 364 EXPECT_EQ(10.0, mouse_wheel_0.event.TimeStampSeconds()); | 364 EXPECT_EQ(10.0, mouse_wheel_0.event.TimeStampSeconds()); |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace | 367 } // namespace |
| 368 } // namespace content | 368 } // namespace content |
| OLD | NEW |