Merge "Verifying that workspace looks correct at the end of the test." into main

This commit is contained in:
Vadim Tryshev
2023-09-14 23:44:24 +00:00
committed by Android (Google) Code Review
4 changed files with 69 additions and 22 deletions

View File

@@ -16,9 +16,7 @@
package com.android.quickstep;
import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS;
import static com.android.launcher3.tapl.TestHelpers.getHomeIntentInPackage;
import static com.android.launcher3.tapl.TestHelpers.getLauncherInMyProcess;
@@ -34,7 +32,6 @@ import static com.android.launcher3.util.rule.ShellCommandRule.disableHeadsUpNot
import static com.android.launcher3.util.rule.ShellCommandRule.getLauncherCommand;
import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -61,6 +58,7 @@ import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.FailureWatcher;
import com.android.launcher3.util.rule.SamplerRule;
import com.android.launcher3.util.rule.ScreenRecordRule;
import com.android.launcher3.util.rule.TestIsolationRule;
import com.android.launcher3.util.rule.TestStabilityRule;
import com.android.launcher3.util.rule.ViewCaptureRule;
import com.android.quickstep.views.RecentsView;
@@ -93,9 +91,6 @@ public class FallbackRecentsTest {
@Rule
public final TestRule mDisableHeadsUpNotification = disableHeadsUpNotification();
@Rule
public final TestRule mSetLauncherCommand;
@Rule
public final TestRule mOrderSensitiveRules;
@@ -116,19 +111,7 @@ public class FallbackRecentsTest {
Utilities.enableRunningInTestHarnessForTests();
}
final ViewCaptureRule viewCaptureRule = new ViewCaptureRule(
RecentsActivity.ACTIVITY_TRACKER::getCreatedActivity);
mOrderSensitiveRules = RuleChain
.outerRule(new SamplerRule())
.around(new NavigationModeSwitchRule(mLauncher))
.around(new FailureWatcher(mLauncher, viewCaptureRule::getViewCaptureData))
.around(viewCaptureRule);
mOtherLauncherActivity = context.getPackageManager().queryIntentActivities(
getHomeIntentInPackage(context),
MATCH_DISABLED_COMPONENTS).get(0).activityInfo;
mSetLauncherCommand = (base, desc) -> new Statement() {
final TestRule setLauncherCommand = (base, desc) -> new Statement() {
@Override
public void evaluate() throws Throwable {
TestCommandReceiver.callCommand(TestCommandReceiver.ENABLE_TEST_LAUNCHER);
@@ -151,6 +134,21 @@ public class FallbackRecentsTest {
}
}
};
final ViewCaptureRule viewCaptureRule = new ViewCaptureRule(
RecentsActivity.ACTIVITY_TRACKER::getCreatedActivity);
mOrderSensitiveRules = RuleChain
.outerRule(new SamplerRule())
.around(new NavigationModeSwitchRule(mLauncher))
.around(new FailureWatcher(mLauncher, viewCaptureRule::getViewCaptureData))
.around(viewCaptureRule)
.around(new TestIsolationRule(mLauncher))
.around(setLauncherCommand);
mOtherLauncherActivity = context.getPackageManager().queryIntentActivities(
getHomeIntentInPackage(context),
MATCH_DISABLED_COMPONENTS).get(0).activityInfo;
if (TestHelpers.isInLauncherProcess()) {
mLauncher.setSystemHealthSupplier(startTime -> TestCommandReceiver.callCommand(
TestCommandReceiver.GET_SYSTEM_HEALTH_MESSAGE, startTime.toString()).