diff options
author | Vadim Tryshev <vadimt@google.com> | 2018-10-04 16:33:45 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2018-10-04 16:33:45 -0700 |
commit | c295098e187189d72008f8061336f8633a2e316e (patch) | |
tree | 7d42857f01d8fcf9d48cfeb1d9d549758881eaf1 /tests/tapl | |
parent | bb24884801320d7e70528a4258bd76896f37b9b8 (diff) | |
download | android_packages_apps_Trebuchet-c295098e187189d72008f8061336f8633a2e316e.tar.gz android_packages_apps_Trebuchet-c295098e187189d72008f8061336f8633a2e316e.tar.bz2 android_packages_apps_Trebuchet-c295098e187189d72008f8061336f8633a2e316e.zip |
Enabling "in test harness" flag with a direct call
This allows running in-proc tests without enabling test harness on
Android and restarting Launcher.
Bug: 110103162
Test: TaplTests
Change-Id: Ife44eff4760eb1349a10847efe2c1f27643bf146
Diffstat (limited to 'tests/tapl')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java | 10 |
1 files changed, 9 insertions, 1 deletions
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. |