mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Change LauncherState to Supplier<LauncherState> in tests
This prevents the test from statically initializing LauncherState and all its static dependencies, which might lead to runtime exceptions in out-of-proc tests. Change-Id: I0e4e09dfb31a8b256c2c0c0b3d1d2ecd0cc92230
This commit is contained in:
@@ -84,6 +84,7 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Base class for all instrumentation tests providing various utility methods.
|
||||
@@ -281,9 +282,9 @@ public abstract class AbstractLauncherUiTest {
|
||||
|
||||
// Cannot be used in TaplTests between a Tapl call injecting a gesture and a tapl call expecting
|
||||
// the results of that gesture because the wait can hide flakeness.
|
||||
protected void waitForState(String message, LauncherState state) {
|
||||
protected void waitForState(String message, Supplier<LauncherState> state) {
|
||||
waitForLauncherCondition(message,
|
||||
launcher -> launcher.getStateManager().getCurrentStableState() == state);
|
||||
launcher -> launcher.getStateManager().getCurrentStableState() == state.get());
|
||||
}
|
||||
|
||||
protected void waitForResumed(String message) {
|
||||
@@ -430,9 +431,9 @@ public abstract class AbstractLauncherUiTest {
|
||||
return !launcher.hasBeenResumed();
|
||||
}
|
||||
|
||||
protected boolean isInState(LauncherState state) {
|
||||
protected boolean isInState(Supplier<LauncherState> state) {
|
||||
if (!TestHelpers.isInLauncherProcess()) return true;
|
||||
return getFromLauncher(launcher -> launcher.getStateManager().getState() == state);
|
||||
return getFromLauncher(launcher -> launcher.getStateManager().getState() == state.get());
|
||||
}
|
||||
|
||||
protected int getAllAppsScroll(Launcher launcher) {
|
||||
|
||||
Reference in New Issue
Block a user