summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java4
-rw-r--r--tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java10
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index fc8e1c51e..6c44d81e3 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -49,6 +49,7 @@ import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherState;
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.tapl.LauncherInstrumentation;
@@ -94,13 +95,14 @@ public abstract class AbstractLauncherUiTest {
private static final String TAG = "AbstractLauncherUiTest";
protected AbstractLauncherUiTest() {
- final Instrumentation instrumentation =TestHelpers.getInstrumentation();
+ final Instrumentation instrumentation = TestHelpers.getInstrumentation();
mDevice = UiDevice.getInstance(instrumentation);
try {
mDevice.setOrientationNatural();
} catch (RemoteException e) {
throw new RuntimeException(e);
}
+ if (TestHelpers.isInLauncherProcess()) Utilities.enableRunningInTestHarnessForTests();
mLauncher = new LauncherInstrumentation(instrumentation);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 7885e3cce..66dfe41c2 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -108,7 +108,15 @@ public final class LauncherInstrumentation {
instrumentation.getTargetContext().getContentResolver(),
SWIPE_UP_SETTING_NAME,
swipeUpEnabledDefault ? 1 : 0) == 1;
- assertTrue("Device must run in a test harness", ActivityManager.isRunningInTestHarness());
+
+ // Launcher should run in test harness so that custom accessibility protocol between
+ // Launcher and TAPL is enabled. In-process tests enable this protocol with a direct call
+ // into Launcher.
+ final boolean isInLauncherProcess =
+ instrumentation.getTargetContext().getPackageName().equals(
+ UiDevice.getInstance(instrumentation).getLauncherPackageName());
+ assertTrue("Device must run in a test harness",
+ isInLauncherProcess || ActivityManager.isRunningInTestHarness());
}
// Used only by TaplTests.