Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2020 The Chromium Authors |
Mario Bianucci | 926a2d9 | 2020-07-28 02:04:32 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UI_BASE_PREDICTION_PREDICTION_UNITTEST_HELPERS_H_ |
| 6 | #define UI_BASE_PREDICTION_PREDICTION_UNITTEST_HELPERS_H_ |
| 7 | |
| 8 | #include "base/time/time.h" |
| 9 | |
| 10 | namespace ui { |
| 11 | namespace test { |
| 12 | |
| 13 | class PredictionUnittestHelpers { |
| 14 | public: |
| 15 | // Copied from third_party\blink\public\common\input\web_input_event.h |
| 16 | static constexpr base::TimeTicks GetStaticTimeStampForTests() { |
| 17 | // Note: intentionally use a relatively large delta from base::TimeTicks == |
| 18 | // 0. Otherwise, code that tracks the time ticks of the last event that |
| 19 | // happened and computes a delta might get confused when the testing |
| 20 | // timestamp is near 0, as the computed delta may very well be under the |
| 21 | // delta threshold. |
| 22 | // |
| 23 | // TODO(dcheng): This really shouldn't use FromInternalValue(), but |
| 24 | // constexpr support for time operations is a bit busted... |
| 25 | return base::TimeTicks::FromInternalValue(123'000'000); |
| 26 | } |
| 27 | }; |
| 28 | |
| 29 | } // namespace test |
| 30 | } // namespace ui |
| 31 | |
| 32 | #endif // UI_BASE_PREDICTION_PREDICTION_UNITTEST_HELPERS_H_ |