Fixing some tests

> Adding retry to fallback recents tests
> Fixing provider test after provider name change
> Fixing AllApps icon detection when there is no more scroll available

Bug: 141390432
Bug: 141523101
Bug: 141517004
Bug: 141524555
Bug: 141522764
Change-Id: I425638d20c053206134835dabde819f16160f035
This commit is contained in:
Sunny Goyal committed 2019-09-24 15:10:06 -07:00
1 parent a4deb15c30
commit 599e95bdde
3 files changed
+26 -13

No files matched your search

@@ -53,6 +53,7 @@ import com.android.launcher3.tapl.LauncherInstrumentation;
import com.android.launcher3.tapl.OverviewTask;
import com.android.launcher3.tapl.TestHelpers;
import com.android.launcher3.testcomponent.TestCommandReceiver;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.FailureWatcher;
import com.android.launcher3.util.rule.SimpleActivityRule;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
@@ -147,16 +148,25 @@ public class FallbackRecentsTest {
mLauncher.getBackground().switchToOverview();
}
protected void executeOnRecents(Consumer<RecentsActivity> f) throws Exception {
protected void executeOnRecents(Consumer<RecentsActivity> f) {
getFromRecents(r -> {
f.accept(r);
return null;
return true;
});
}
protected <T> T getFromRecents(Function<RecentsActivity, T> f) throws Exception {
protected <T> T getFromRecents(Function<RecentsActivity, T> f) {
if (!TestHelpers.isInLauncherProcess()) return null;
return MAIN_EXECUTOR.submit(() -> f.apply(mActivityMonitor.getActivity())).get();
Object[] result = new Object[1];
Wait.atMost("Failed to get from recents", () -> MAIN_EXECUTOR.submit(() -> {
RecentsActivity activity = mActivityMonitor.getActivity();
if (activity == null) {
return false;
}
result[0] = f.apply(activity);
return true;
}).get(), DEFAULT_UI_TIMEOUT);
return (T) result[0];
}
private BaseOverview pressHomeAndGoToOverview() {
@@ -166,7 +176,7 @@ public class FallbackRecentsTest {
@NavigationModeSwitch
@Test
public void testOverview() throws Exception {
public void testOverview() {
startAppFast(getAppPackageName());
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
startTestActivity(2);