Merge "Make sure TAPL waits for Launcher activity to stop each time it stops" into main

This commit is contained in:
Vadim Tryshev
2024-02-03 02:33:53 +00:00
committed by Android (Google) Code Review
6 changed files with 53 additions and 2 deletions

View File

@@ -599,6 +599,9 @@ public abstract class AbstractLauncherUiTest {
Wait.atMost("Launcher activity didn't stop",
() -> !launcherInstrumentation.isLauncherActivityStarted(),
DEFAULT_ACTIVITY_TIMEOUT, launcherInstrumentation);
// Reset activity stop count.
launcherInstrumentation.getAndResetActivityStopCount();
}
public static ActivityInfo resolveSystemAppInfo(String category) {

View File

@@ -44,11 +44,15 @@ public class TestIsolationRule implements TestRule {
return new Statement() {
@Override
public void evaluate() throws Throwable {
base.evaluate();
// Make sure that Launcher workspace looks correct.
// Reset activity stop count.
mLauncher.getAndResetActivityStopCount();
base.evaluate();
// Make sure that Launcher workspace looks correct.
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).pressHome();
AbstractLauncherUiTest.checkDetectedLeaks(mLauncher, mRequireOneActiveActivity);
mLauncher.assertNoUnexpectedStops();
}
};
}