Fail tests quickly if they don't start within the host activity

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202965785
This commit is contained in:
olly 2018-07-02 09:46:59 -07:00 committed by Oliver Woodman
parent c8af6d176f
commit e48b712a32

View file

@ -80,6 +80,7 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
}
private static final String TAG = "HostActivity";
private static final long START_TIMEOUT_MS = 5000;
private WakeLock wakeLock;
private WifiLock wifiLock;
@ -124,7 +125,13 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
maybeStartHostedTest();
}
});
hostedTestStartedCondition.block();
if (!hostedTestStartedCondition.block(START_TIMEOUT_MS)) {
String message =
"Test failed to start. Display may be turned off or keyguard may be present.";
Log.e(TAG, message);
fail(message);
}
if (hostedTest.blockUntilStopped(timeoutMs)) {
if (!forcedStopped) {