aboutsummaryrefslogtreecommitdiff
path: root/tests/common/src/com/android/tv/testing/FakeClock.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common/src/com/android/tv/testing/FakeClock.java')
-rw-r--r--tests/common/src/com/android/tv/testing/FakeClock.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/common/src/com/android/tv/testing/FakeClock.java b/tests/common/src/com/android/tv/testing/FakeClock.java
index d88e53a8..f5941939 100644
--- a/tests/common/src/com/android/tv/testing/FakeClock.java
+++ b/tests/common/src/com/android/tv/testing/FakeClock.java
@@ -16,8 +16,7 @@
package com.android.tv.testing;
-import com.android.tv.util.Clock;
-
+import com.android.tv.common.util.Clock;
import java.util.concurrent.TimeUnit;
/**
@@ -27,21 +26,20 @@ import java.util.concurrent.TimeUnit;
* {@link #sleep(long)} is called.
*/
public class FakeClock implements Clock {
- /**
- * Creates a fake clock with the time set to now and the boot time set to now - 100,000.
- */
+ /** Creates a fake clock with the time set to now and the boot time set to now - 100,000. */
public static FakeClock createWithCurrentTime() {
long now = System.currentTimeMillis();
return new FakeClock(now, now - 100_000);
}
- /**
- * Creates a fake clock with the time set to zero.
- */
+ /** Creates a fake clock with the time set to zero. */
public static FakeClock createWithTimeOne() {
return new FakeClock(1L, 0L);
}
-
+ /** Creates a fake clock with the time set to {@code time}. */
+ public static FakeClock createWithTime(long time) {
+ return new FakeClock(time, 0L);
+ }
private long mCurrentTimeMillis;
@@ -95,9 +93,12 @@ public class FakeClock implements Clock {
return mCurrentTimeMillis - mBootTimeMillis;
}
- /**
- * Sleep does not block it just updates the current time.
- */
+ @Override
+ public long uptimeMillis() {
+ return elapsedRealtime();
+ }
+
+ /** Sleep does not block it just updates the current time. */
@Override
public void sleep(long ms) {
// TODO: implement blocking if needed.