Loading src/com/android/launcher3/popup/PopupContainerWithArrow.java +4 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,10 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, factory.getEnabledShortcuts(mLauncher, item)); } public ViewGroup getSystemShortcutContainerForTesting() { return mSystemShortcutContainer; } @TargetApi(Build.VERSION_CODES.P) protected void populateAndShow(final BubbleTextView originalIcon, int shortcutCount, final List<NotificationKeyData> notificationKeys, List<SystemShortcut> systemShortcuts) { Loading src/com/android/launcher3/views/OptionsPopupView.java +1 −1 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ public class OptionsPopupView extends ArrowPopup } @VisibleForTesting public static OptionsPopupView getOptionsPopup(Launcher launcher) { public static ArrowPopup getOptionsPopup(Launcher launcher) { return launcher.findViewById(R.id.deep_shortcuts_container); } Loading tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import org.junit.Rule; import org.junit.rules.TestRule; import org.junit.runners.model.Statement; import java.io.IOException; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -168,6 +169,16 @@ public abstract class AbstractLauncherUiTest { } } protected void clearLauncherData() throws IOException { if (TestHelpers.isInLauncherProcess()) { LauncherSettings.Settings.call(mTargetContext.getContentResolver(), LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB); resetLoaderState(); } else { mDevice.executeShellCommand("pm clear " + mDevice.getLauncherPackageName()); } } /** * Scrolls the {@param container} until it finds an object matching {@param condition}. * @return the matching object. Loading Loading @@ -261,6 +272,10 @@ public abstract class AbstractLauncherUiTest { launcher -> launcher.getStateManager().getState() == state); } protected void waitForResumed(String message) { waitForLauncherCondition(message, launcher -> launcher.hasBeenResumed()); } // Cannot be used in TaplTests after injecting any gesture using Tapl because this can hide // flakiness. protected void waitForLauncherCondition(String message, Function<Launcher, Boolean> condition) { Loading tests/src/com/android/launcher3/ui/TestViewHelpers.java +11 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import android.os.Process; import android.os.SystemClock; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; Loading @@ -42,6 +44,7 @@ import com.android.launcher3.testcomponent.AppWidgetNoConfig; import com.android.launcher3.testcomponent.AppWidgetWithConfig; import java.util.concurrent.Callable; import java.util.function.Function; public class TestViewHelpers { private static final String TAG = "TestViewHelpers"; Loading Loading @@ -183,4 +186,12 @@ public class TestViewHelpers { AbstractLauncherUiTest.DEFAULT_UI_TIMEOUT).click(); return findViewById(R.id.widgets_list_view); } public static View findChildView(ViewGroup parent, Function<View, Boolean> condition) { for (int i = 0; i < parent.getChildCount(); ++i) { final View child = parent.getChildAt(i); if (condition.apply(child)) return child; } return null; } } Loading
src/com/android/launcher3/popup/PopupContainerWithArrow.java +4 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,10 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, factory.getEnabledShortcuts(mLauncher, item)); } public ViewGroup getSystemShortcutContainerForTesting() { return mSystemShortcutContainer; } @TargetApi(Build.VERSION_CODES.P) protected void populateAndShow(final BubbleTextView originalIcon, int shortcutCount, final List<NotificationKeyData> notificationKeys, List<SystemShortcut> systemShortcuts) { Loading
src/com/android/launcher3/views/OptionsPopupView.java +1 −1 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ public class OptionsPopupView extends ArrowPopup } @VisibleForTesting public static OptionsPopupView getOptionsPopup(Launcher launcher) { public static ArrowPopup getOptionsPopup(Launcher launcher) { return launcher.findViewById(R.id.deep_shortcuts_container); } Loading
tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import org.junit.Rule; import org.junit.rules.TestRule; import org.junit.runners.model.Statement; import java.io.IOException; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading Loading @@ -168,6 +169,16 @@ public abstract class AbstractLauncherUiTest { } } protected void clearLauncherData() throws IOException { if (TestHelpers.isInLauncherProcess()) { LauncherSettings.Settings.call(mTargetContext.getContentResolver(), LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB); resetLoaderState(); } else { mDevice.executeShellCommand("pm clear " + mDevice.getLauncherPackageName()); } } /** * Scrolls the {@param container} until it finds an object matching {@param condition}. * @return the matching object. Loading Loading @@ -261,6 +272,10 @@ public abstract class AbstractLauncherUiTest { launcher -> launcher.getStateManager().getState() == state); } protected void waitForResumed(String message) { waitForLauncherCondition(message, launcher -> launcher.hasBeenResumed()); } // Cannot be used in TaplTests after injecting any gesture using Tapl because this can hide // flakiness. protected void waitForLauncherCondition(String message, Function<Launcher, Boolean> condition) { Loading
tests/src/com/android/launcher3/ui/TestViewHelpers.java +11 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import android.os.Process; import android.os.SystemClock; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; Loading @@ -42,6 +44,7 @@ import com.android.launcher3.testcomponent.AppWidgetNoConfig; import com.android.launcher3.testcomponent.AppWidgetWithConfig; import java.util.concurrent.Callable; import java.util.function.Function; public class TestViewHelpers { private static final String TAG = "TestViewHelpers"; Loading Loading @@ -183,4 +186,12 @@ public class TestViewHelpers { AbstractLauncherUiTest.DEFAULT_UI_TIMEOUT).click(); return findViewById(R.id.widgets_list_view); } public static View findChildView(ViewGroup parent, Function<View, Boolean> condition) { for (int i = 0; i < parent.getChildCount(); ++i) { final View child = parent.getChildAt(i); if (condition.apply(child)) return child; } return null; } }