blob: fd334e34d9df636ac6fde66fc446032371548610 [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2020 The Chromium Authors
Mario Bianucci926a2d92020-07-28 02:04:322// 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
10namespace ui {
11namespace test {
12
13class 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_