commit | 6b47bf6c075e466d64511eeb38b15a7e8d83bb35 | [log] [tgz] |
---|---|---|
author | Samuel Huang <huangs@chromium.org> | Thu May 16 02:26:28 2024 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu May 16 02:26:28 2024 |
tree | e26742e327bc0a9ad74e92c165aa4172e3ddf5d2 | |
parent | 1a7062eeff0851f1f9c7d50b58b943ea234a2e01 [diff] |
[Android TRM] Centralize getCurrentTimeMs(). The Tab Resumption Module uses System.currentTimeMillis() to compute recency string and to measure data fetch delays. To support unit test mocking, we wrap this with method getCurrentTimeMs(). Development saw getCurrentTimeMs() proliferate to 4 classes. This CL dedups the method and moves it to TabResumptionModuleUtils (static). Overriding is done via a lambda (instead of Long) to give tests the flexibility of defining a |mFakeTime| value that can be increased to advance fake time. Details: * Remove getCurrentTimeMs() copies from 4 classes. * TabResumptionModuleUtils: * Add interface FakeGetCurrentTimeMs, stored as static field. * Add static setFakeCurrentTimeMsForTesting() for mocking. * Add static getCurrentTimeMs(). * Update 4 tests to use setFakeCurrentTimeMsForTesting(). Testing: Change-Id: Ibf3e417374902949bc95908ac4d987b0670120be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539451 Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com> Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Xi Han <hanxi@chromium.org> Cr-Commit-Position: refs/heads/main@{#1301724}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.