summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJW Wang <wangchun@google.com>2019-09-02 03:28:31 +0000
committerJW Wang <wangchun@google.com>2019-09-04 10:01:30 +0800
commit2d085672e31705dc332620f2303014d288396fcc (patch)
treed3b800780413fc7590253e4e61d755f018e7b4d2 /tests
parent7baee5c357e89c2edbe3ea302f4f40bfe330fa8e (diff)
Add a wrapper around SystemClock.uptimeMillis().
This bug is motivated by bug 140208026 where we want to replace Thread.sleep() with TestLooper.moveTimeForward() in PackageWatchdogTest.java. However, it turns out that PackageWatchdog uses SystemClock.uptimeMillis() internally. The tests will fail if we don't forward PackageWatchdog's internal clock accordingly. We add a wrapper around SystemClock.uptimeMillis() so it is customizable by the test case. Bug: 140358475 Test: atest PackageWatchdogTest Change-Id: Id26325a93dc4050c6468502347b0e7852ed1263f
Diffstat (limited to 'tests')
-rw-r--r--tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
index c42201fa0d3e..47fefaeabc18 100644
--- a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
+++ b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
@@ -782,7 +782,7 @@ public class PackageWatchdogTest {
Handler handler = new Handler(mTestLooper.getLooper());
PackageWatchdog watchdog =
new PackageWatchdog(mSpyContext, policyFile, handler, handler, controller,
- mConnectivityModuleConnector);
+ mConnectivityModuleConnector, android.os.SystemClock::uptimeMillis);
// Verify controller is not automatically started
assertFalse(controller.mIsEnabled);
if (withPackagesReady) {