Commit e48b712a by olly Committed by Oliver Woodman

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

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202965785
parent c8af6d17
...@@ -80,6 +80,7 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba ...@@ -80,6 +80,7 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
} }
private static final String TAG = "HostActivity"; private static final String TAG = "HostActivity";
private static final long START_TIMEOUT_MS = 5000;
private WakeLock wakeLock; private WakeLock wakeLock;
private WifiLock wifiLock; private WifiLock wifiLock;
...@@ -124,7 +125,13 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba ...@@ -124,7 +125,13 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
maybeStartHostedTest(); 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 (hostedTest.blockUntilStopped(timeoutMs)) {
if (!forcedStopped) { if (!forcedStopped) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment