Merge "More improvements for wellbeing tests" into ub-launcher3-qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1f457ae87f
@@ -140,6 +140,10 @@ public class LauncherStateManager {
|
|||||||
return mState;
|
return mState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LauncherState getCurrentStableState() {
|
||||||
|
return mCurrentStableState;
|
||||||
|
}
|
||||||
|
|
||||||
public StateHandler[] getStateHandlers() {
|
public StateHandler[] getStateHandlers() {
|
||||||
if (mStateHandlers == null) {
|
if (mStateHandlers == null) {
|
||||||
mStateHandlers = UiFactory.getStateHandler(mLauncher);
|
mStateHandlers = UiFactory.getStateHandler(mLauncher);
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ public abstract class AbstractLauncherUiTest {
|
|||||||
// the results of that gesture because the wait can hide flakeness.
|
// the results of that gesture because the wait can hide flakeness.
|
||||||
protected void waitForState(String message, LauncherState state) {
|
protected void waitForState(String message, LauncherState state) {
|
||||||
waitForLauncherCondition(message,
|
waitForLauncherCondition(message,
|
||||||
launcher -> launcher.getStateManager().getState() == state);
|
launcher -> launcher.getStateManager().getCurrentStableState() == state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void waitForResumed(String message) {
|
protected void waitForResumed(String message) {
|
||||||
@@ -301,6 +301,19 @@ public abstract class AbstractLauncherUiTest {
|
|||||||
Wait.atMost(message, () -> getFromLauncher(condition), timeout);
|
Wait.atMost(message, () -> getFromLauncher(condition), timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cannot be used in TaplTests after injecting any gesture using Tapl because this can hide
|
||||||
|
// flakiness.
|
||||||
|
protected void waitForLauncherCondition(
|
||||||
|
String message,
|
||||||
|
Runnable testThreadAction, Function<Launcher, Boolean> condition,
|
||||||
|
long timeout) {
|
||||||
|
if (!TestHelpers.isInLauncherProcess()) return;
|
||||||
|
Wait.atMost(message, () -> {
|
||||||
|
testThreadAction.run();
|
||||||
|
return getFromLauncher(condition);
|
||||||
|
}, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
protected LauncherActivityInfo getSettingsApp() {
|
protected LauncherActivityInfo getSettingsApp() {
|
||||||
return LauncherAppsCompat.getInstance(mTargetContext)
|
return LauncherAppsCompat.getInstance(mTargetContext)
|
||||||
.getActivityList("com.android.settings",
|
.getActivityList("com.android.settings",
|
||||||
|
|||||||
Reference in New Issue
Block a user