Loading quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -219,7 +219,7 @@ public class FallbackRecentsTest { OverviewTask task = overview.getCurrentTask(); assertNotNull("overview.getCurrentTask() returned null (1)", task); assertNotNull("OverviewTask.open returned null", task.open()); assertTrue("Test activity didn't open from Overview", mDevice.wait(Until.hasObject( assertTrue("Test activity didn't open from Overview", TestHelpers.wait(Until.hasObject( By.pkg(getAppPackageName()).text("TestActivity2")), DEFAULT_UI_TIMEOUT)); Loading @@ -236,7 +236,7 @@ public class FallbackRecentsTest { // Test dismissing all tasks. pressHomeAndGoToOverview().dismissAllTasks(); assertTrue("Fallback Launcher not visible", mDevice.wait(Until.hasObject(By.pkg( assertTrue("Fallback Launcher not visible", TestHelpers.wait(Until.hasObject(By.pkg( mOtherLauncherActivity.packageName)), WAIT_TIME_MS)); } Loading tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -244,7 +244,7 @@ public abstract class AbstractLauncherUiTest { @Before public void setUp() throws Exception { Assert.assertTrue("Keyguard is visible", mDevice.wait( TestHelpers.wait( Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000)); final String launcherPackageName = mDevice.getLauncherPackageName(); Loading Loading @@ -477,8 +477,7 @@ public abstract class AbstractLauncherUiTest { } getInstrumentation().getTargetContext().startActivity(intent); assertTrue("App didn't start: " + selector, UiDevice.getInstance(getInstrumentation()) .wait(Until.hasObject(selector), DEFAULT_UI_TIMEOUT)); TestHelpers.wait(Until.hasObject(selector), DEFAULT_UI_TIMEOUT)); } public static ActivityInfo resolveSystemAppInfo(String category) { Loading tests/tapl/com/android/launcher3/tapl/Launchable.java +1 −2 Original line number Diff line number Diff line Loading @@ -68,8 +68,7 @@ abstract class Launchable { mLauncher.assertTrue( "App didn't start: " + label, mLauncher.getDevice().wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); TestHelpers.wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); return new Background(mLauncher); } Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +1 −1 Original line number Diff line number Diff line Loading @@ -933,7 +933,7 @@ public final class LauncherInstrumentation { @NonNull UiObject2 waitForAndroidObject(String resId) { final UiObject2 object = mDevice.wait( final UiObject2 object = TestHelpers.wait( Until.findObject(By.res(ANDROID_PACKAGE, resId)), WAIT_TIME_MS); assertNotNull("Can't find a android object with id: " + resId, object); return object; Loading tests/tapl/com/android/launcher3/tapl/TestHelpers.java +14 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,11 @@ import android.content.pm.ActivityInfo; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.os.DropBoxManager; import android.os.SystemClock; import android.util.Log; import androidx.test.uiautomator.SearchCondition; import androidx.test.uiautomator.UiDevice; import org.junit.Assert; Loading @@ -35,6 +40,7 @@ import java.util.List; public class TestHelpers { private static final String TAG = "Tapl"; private static Boolean sIsInLauncherProcess; public static boolean isInLauncherProcess() { Loading Loading @@ -154,4 +160,12 @@ public class TestHelpers { return null; } } public static <R> R wait(SearchCondition<R> condition, long timeout) { Log.d(TAG, "TestHelpers.wait, condition=" + timeout + ", time=" + SystemClock.uptimeMillis()); final R result = UiDevice.getInstance(getInstrumentation()).wait(condition, timeout); Log.d(TAG, "TestHelpers.wait, result=" + result + ", time=" + SystemClock.uptimeMillis()); return result; } } Loading
quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -219,7 +219,7 @@ public class FallbackRecentsTest { OverviewTask task = overview.getCurrentTask(); assertNotNull("overview.getCurrentTask() returned null (1)", task); assertNotNull("OverviewTask.open returned null", task.open()); assertTrue("Test activity didn't open from Overview", mDevice.wait(Until.hasObject( assertTrue("Test activity didn't open from Overview", TestHelpers.wait(Until.hasObject( By.pkg(getAppPackageName()).text("TestActivity2")), DEFAULT_UI_TIMEOUT)); Loading @@ -236,7 +236,7 @@ public class FallbackRecentsTest { // Test dismissing all tasks. pressHomeAndGoToOverview().dismissAllTasks(); assertTrue("Fallback Launcher not visible", mDevice.wait(Until.hasObject(By.pkg( assertTrue("Fallback Launcher not visible", TestHelpers.wait(Until.hasObject(By.pkg( mOtherLauncherActivity.packageName)), WAIT_TIME_MS)); } Loading
tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -244,7 +244,7 @@ public abstract class AbstractLauncherUiTest { @Before public void setUp() throws Exception { Assert.assertTrue("Keyguard is visible", mDevice.wait( TestHelpers.wait( Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000)); final String launcherPackageName = mDevice.getLauncherPackageName(); Loading Loading @@ -477,8 +477,7 @@ public abstract class AbstractLauncherUiTest { } getInstrumentation().getTargetContext().startActivity(intent); assertTrue("App didn't start: " + selector, UiDevice.getInstance(getInstrumentation()) .wait(Until.hasObject(selector), DEFAULT_UI_TIMEOUT)); TestHelpers.wait(Until.hasObject(selector), DEFAULT_UI_TIMEOUT)); } public static ActivityInfo resolveSystemAppInfo(String category) { Loading
tests/tapl/com/android/launcher3/tapl/Launchable.java +1 −2 Original line number Diff line number Diff line Loading @@ -68,8 +68,7 @@ abstract class Launchable { mLauncher.assertTrue( "App didn't start: " + label, mLauncher.getDevice().wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); TestHelpers.wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); return new Background(mLauncher); } Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +1 −1 Original line number Diff line number Diff line Loading @@ -933,7 +933,7 @@ public final class LauncherInstrumentation { @NonNull UiObject2 waitForAndroidObject(String resId) { final UiObject2 object = mDevice.wait( final UiObject2 object = TestHelpers.wait( Until.findObject(By.res(ANDROID_PACKAGE, resId)), WAIT_TIME_MS); assertNotNull("Can't find a android object with id: " + resId, object); return object; Loading
tests/tapl/com/android/launcher3/tapl/TestHelpers.java +14 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,11 @@ import android.content.pm.ActivityInfo; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.os.DropBoxManager; import android.os.SystemClock; import android.util.Log; import androidx.test.uiautomator.SearchCondition; import androidx.test.uiautomator.UiDevice; import org.junit.Assert; Loading @@ -35,6 +40,7 @@ import java.util.List; public class TestHelpers { private static final String TAG = "Tapl"; private static Boolean sIsInLauncherProcess; public static boolean isInLauncherProcess() { Loading Loading @@ -154,4 +160,12 @@ public class TestHelpers { return null; } } public static <R> R wait(SearchCondition<R> condition, long timeout) { Log.d(TAG, "TestHelpers.wait, condition=" + timeout + ", time=" + SystemClock.uptimeMillis()); final R result = UiDevice.getInstance(getInstrumentation()).wait(condition, timeout); Log.d(TAG, "TestHelpers.wait, result=" + result + ", time=" + SystemClock.uptimeMillis()); return result; } }