mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Merge "More tracing for wellbeing tests" into ub-launcher3-qt-qpr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d33894c771
@@ -1,6 +1,7 @@
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -16,7 +17,9 @@ public class Wait {
|
||||
}
|
||||
|
||||
public static void atMost(String message, Condition condition, long timeout, long sleepMillis) {
|
||||
long endTime = SystemClock.uptimeMillis() + timeout;
|
||||
final long startTime = SystemClock.uptimeMillis();
|
||||
long endTime = startTime + timeout;
|
||||
Log.d("Wait", "atMost: " + startTime + " - " + endTime);
|
||||
while (SystemClock.uptimeMillis() < endTime) {
|
||||
try {
|
||||
if (condition.isTrue()) {
|
||||
@@ -36,6 +39,7 @@ public class Wait {
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
Log.d("Wait", "atMost: timed out: " + SystemClock.uptimeMillis());
|
||||
Assert.fail(message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user