Loading quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +13 −3 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import com.android.launcher3.util.rule.FailureWatcher; import com.android.quickstep.views.RecentsView; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.RuleChain; Loading Loading @@ -142,10 +143,19 @@ public class FallbackRecentsTest { } } @Before public void setUp() { mLauncher.onTestStart(); } @After public void verifyLauncherState() { public void tearDown() { try { // Limits UI tests affecting tests running after them. AbstractQuickStepTest.checkDetectedLeaks(mLauncher); } finally { mLauncher.onTestFinish(); } } // b/143488140 Loading tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +11 −6 Original line number Diff line number Diff line Loading @@ -249,6 +249,7 @@ public abstract class AbstractLauncherUiTest { @Before public void setUp() throws Exception { mLauncher.onTestStart(); Assert.assertTrue("Keyguard is visible, which is likely caused by a crash in SysUI", TestHelpers.wait( Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000)); Loading Loading @@ -288,6 +289,7 @@ public abstract class AbstractLauncherUiTest { @After public void verifyLauncherState() { try { // Limits UI tests affecting tests running after them. mLauncher.waitForLauncherInitialized(); if (mLauncherPid != 0) { Loading @@ -295,6 +297,9 @@ public abstract class AbstractLauncherUiTest { mLauncherPid, mLauncher.getPid().intValue()); } checkDetectedLeaks(mLauncher); } finally { mLauncher.onTestFinish(); } } protected void clearLauncherData() { Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +18 −8 Original line number Diff line number Diff line Loading @@ -95,7 +95,6 @@ public final class LauncherInstrumentation { private static final String TAG = "Tapl"; private static final int ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME = 20; private static final int GESTURE_STEP_MS = 16; private static long START_TIME = System.currentTimeMillis(); private static final Pattern EVENT_TOUCH_DOWN = getTouchEventPattern("ACTION_DOWN"); private static final Pattern EVENT_TOUCH_UP = getTouchEventPattern("ACTION_UP"); Loading @@ -107,6 +106,7 @@ public final class LauncherInstrumentation { static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP"); private final String mLauncherPackage; private final boolean mIsLauncher3; private long mTestStartTime = -1; // Types for launcher containers that the user is interacting with. "Background" is a // pseudo-container corresponding to inactive launcher covered by another app. Loading Loading @@ -422,6 +422,14 @@ public final class LauncherInstrumentation { mOnSettledStateAction = onSettledStateAction; } public void onTestStart() { mTestStartTime = System.currentTimeMillis(); } public void onTestFinish() { mTestStartTime = -1; } private String formatSystemHealthMessage(String message) { final String testPackage = getContext().getPackageName(); Loading @@ -430,15 +438,17 @@ public final class LauncherInstrumentation { mInstrumentation.getUiAutomation().grantRuntimePermission( testPackage, "android.permission.PACKAGE_USAGE_STATS"); if (mTestStartTime > 0) { final String systemHealth = mSystemHealthSupplier != null ? mSystemHealthSupplier.apply(START_TIME) : TestHelpers.getSystemHealthMessage(getContext(), START_TIME); ? mSystemHealthSupplier.apply(mTestStartTime) : TestHelpers.getSystemHealthMessage(getContext(), mTestStartTime); if (systemHealth != null) { return message + ",\nperhaps linked to system health problems:\n<<<<<<<<<<<<<<<<<<\n" + systemHealth + "\n>>>>>>>>>>>>>>>>>>"; } } return message; } Loading Loading
quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +13 −3 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import com.android.launcher3.util.rule.FailureWatcher; import com.android.quickstep.views.RecentsView; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.RuleChain; Loading Loading @@ -142,10 +143,19 @@ public class FallbackRecentsTest { } } @Before public void setUp() { mLauncher.onTestStart(); } @After public void verifyLauncherState() { public void tearDown() { try { // Limits UI tests affecting tests running after them. AbstractQuickStepTest.checkDetectedLeaks(mLauncher); } finally { mLauncher.onTestFinish(); } } // b/143488140 Loading
tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +11 −6 Original line number Diff line number Diff line Loading @@ -249,6 +249,7 @@ public abstract class AbstractLauncherUiTest { @Before public void setUp() throws Exception { mLauncher.onTestStart(); Assert.assertTrue("Keyguard is visible, which is likely caused by a crash in SysUI", TestHelpers.wait( Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000)); Loading Loading @@ -288,6 +289,7 @@ public abstract class AbstractLauncherUiTest { @After public void verifyLauncherState() { try { // Limits UI tests affecting tests running after them. mLauncher.waitForLauncherInitialized(); if (mLauncherPid != 0) { Loading @@ -295,6 +297,9 @@ public abstract class AbstractLauncherUiTest { mLauncherPid, mLauncher.getPid().intValue()); } checkDetectedLeaks(mLauncher); } finally { mLauncher.onTestFinish(); } } protected void clearLauncherData() { Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +18 −8 Original line number Diff line number Diff line Loading @@ -95,7 +95,6 @@ public final class LauncherInstrumentation { private static final String TAG = "Tapl"; private static final int ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME = 20; private static final int GESTURE_STEP_MS = 16; private static long START_TIME = System.currentTimeMillis(); private static final Pattern EVENT_TOUCH_DOWN = getTouchEventPattern("ACTION_DOWN"); private static final Pattern EVENT_TOUCH_UP = getTouchEventPattern("ACTION_UP"); Loading @@ -107,6 +106,7 @@ public final class LauncherInstrumentation { static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP"); private final String mLauncherPackage; private final boolean mIsLauncher3; private long mTestStartTime = -1; // Types for launcher containers that the user is interacting with. "Background" is a // pseudo-container corresponding to inactive launcher covered by another app. Loading Loading @@ -422,6 +422,14 @@ public final class LauncherInstrumentation { mOnSettledStateAction = onSettledStateAction; } public void onTestStart() { mTestStartTime = System.currentTimeMillis(); } public void onTestFinish() { mTestStartTime = -1; } private String formatSystemHealthMessage(String message) { final String testPackage = getContext().getPackageName(); Loading @@ -430,15 +438,17 @@ public final class LauncherInstrumentation { mInstrumentation.getUiAutomation().grantRuntimePermission( testPackage, "android.permission.PACKAGE_USAGE_STATS"); if (mTestStartTime > 0) { final String systemHealth = mSystemHealthSupplier != null ? mSystemHealthSupplier.apply(START_TIME) : TestHelpers.getSystemHealthMessage(getContext(), START_TIME); ? mSystemHealthSupplier.apply(mTestStartTime) : TestHelpers.getSystemHealthMessage(getContext(), mTestStartTime); if (systemHealth != null) { return message + ",\nperhaps linked to system health problems:\n<<<<<<<<<<<<<<<<<<\n" + systemHealth + "\n>>>>>>>>>>>>>>>>>>"; } } return message; } Loading