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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 bool GetAndResetNeedsFlush() { | 53 bool GetAndResetNeedsFlush() { |
54 bool needs_flush = needs_flush_; | 54 bool needs_flush = needs_flush_; |
55 needs_flush_ = false; | 55 needs_flush_ = false; |
56 return needs_flush; | 56 return needs_flush; |
57 } | 57 } |
58 | 58 |
59 ScopedVector<MotionEvent> GetAndResetForwardedEvents() { | 59 ScopedVector<MotionEvent> GetAndResetForwardedEvents() { |
60 ScopedVector<MotionEvent> forwarded_events; | 60 ScopedVector<MotionEvent> forwarded_events; |
61 forwarded_events.swap(forwarded_events_); | 61 forwarded_events.swap(forwarded_events_); |
62 return forwarded_events.Pass(); | 62 return forwarded_events; |
63 } | 63 } |
64 | 64 |
65 const MotionEvent* GetLastEvent() const { | 65 const MotionEvent* GetLastEvent() const { |
66 return forwarded_events_.empty() ? NULL : forwarded_events_.back(); | 66 return forwarded_events_.empty() ? NULL : forwarded_events_.back(); |
67 } | 67 } |
68 | 68 |
69 static base::TimeDelta LargeDelta() { | 69 static base::TimeDelta LargeDelta() { |
70 return base::TimeDelta::FromMilliseconds(kLargeDeltaMs); | 70 return base::TimeDelta::FromMilliseconds(kLargeDeltaMs); |
71 } | 71 } |
72 | 72 |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 TEST_F(MotionEventBufferTest, Resampling150to60) { | 865 TEST_F(MotionEventBufferTest, Resampling150to60) { |
866 base::TimeDelta flush_time_delta = | 866 base::TimeDelta flush_time_delta = |
867 base::TimeDelta::FromMillisecondsD(1000. / 60.); | 867 base::TimeDelta::FromMillisecondsD(1000. / 60.); |
868 base::TimeDelta event_time_delta = | 868 base::TimeDelta event_time_delta = |
869 base::TimeDelta::FromMillisecondsD(1000. / 150.); | 869 base::TimeDelta::FromMillisecondsD(1000. / 150.); |
870 | 870 |
871 RunResample(flush_time_delta, event_time_delta); | 871 RunResample(flush_time_delta, event_time_delta); |
872 } | 872 } |
873 | 873 |
874 } // namespace ui | 874 } // namespace ui |
OLD | NEW |