Moving prediction files from blink to ui/base in prep to use in viz
Prediction and prediction related features were all used for scrolling
and input events, so they lived in blink and had scrolling specific
names. This CL moved them from being blink and having feature specific
names to being in ui/base with feature-agnostic names.
The motivation for this move is to enable the prediction classes to be
used elsewhere. Specifically, I will be using prediction from viz
in order to predict future points on an ink stroke as part of the
delegated ink trail feature in order to improve user perceived latency.
Bug: 1052145
Change-Id: I3399ecabf962544dc1a4ecefe42583f1d717b6de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2270635
Reviewed-by: Ella Ge <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Sadrul Chowdhury <[email protected]>
Reviewed-by: Daniel Libby <[email protected]>
Reviewed-by: Dave Tapuska <[email protected]>
Commit-Queue: Mario Bianucci <[email protected]>
Cr-Commit-Position: refs/heads/master@{#792110}
diff --git a/ui/base/prediction/prediction_unittest_helpers.h b/ui/base/prediction/prediction_unittest_helpers.h
new file mode 100644
index 0000000..3a22cdd
--- /dev/null
+++ b/ui/base/prediction/prediction_unittest_helpers.h
@@ -0,0 +1,32 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_PREDICTION_PREDICTION_UNITTEST_HELPERS_H_
+#define UI_BASE_PREDICTION_PREDICTION_UNITTEST_HELPERS_H_
+
+#include "base/time/time.h"
+
+namespace ui {
+namespace test {
+
+class PredictionUnittestHelpers {
+ public:
+ // Copied from third_party\blink\public\common\input\web_input_event.h
+ static constexpr base::TimeTicks GetStaticTimeStampForTests() {
+ // Note: intentionally use a relatively large delta from base::TimeTicks ==
+ // 0. Otherwise, code that tracks the time ticks of the last event that
+ // happened and computes a delta might get confused when the testing
+ // timestamp is near 0, as the computed delta may very well be under the
+ // delta threshold.
+ //
+ // TODO(dcheng): This really shouldn't use FromInternalValue(), but
+ // constexpr support for time operations is a bit busted...
+ return base::TimeTicks::FromInternalValue(123'000'000);
+ }
+};
+
+} // namespace test
+} // namespace ui
+
+#endif // UI_BASE_PREDICTION_PREDICTION_UNITTEST_HELPERS_H_