mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Adding test methods
Bug: 117888000 Test: Running new Nexus tests Change-Id: I52a1f89add36dd38bbae8db262dd2e82280db130
This commit is contained in:
@@ -56,6 +56,7 @@ import org.junit.Rule;
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -168,6 +169,16 @@ public abstract class AbstractLauncherUiTest {
|
||||
}
|
||||
}
|
||||
|
||||
protected void clearLauncherData() throws IOException {
|
||||
if (TestHelpers.isInLauncherProcess()) {
|
||||
LauncherSettings.Settings.call(mTargetContext.getContentResolver(),
|
||||
LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB);
|
||||
resetLoaderState();
|
||||
} else {
|
||||
mDevice.executeShellCommand("pm clear " + mDevice.getLauncherPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls the {@param container} until it finds an object matching {@param condition}.
|
||||
* @return the matching object.
|
||||
@@ -261,6 +272,10 @@ public abstract class AbstractLauncherUiTest {
|
||||
launcher -> launcher.getStateManager().getState() == state);
|
||||
}
|
||||
|
||||
protected void waitForResumed(String message) {
|
||||
waitForLauncherCondition(message, launcher -> launcher.hasBeenResumed());
|
||||
}
|
||||
|
||||
// Cannot be used in TaplTests after injecting any gesture using Tapl because this can hide
|
||||
// flakiness.
|
||||
protected void waitForLauncherCondition(String message, Function<Launcher, Boolean> condition) {
|
||||
|
||||
Reference in New Issue
Block a user