summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Tryshev <vadimt@google.com>2019-05-03 17:42:20 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-05-03 17:42:20 +0000
commit2c99205461a3e752c5046a213d9b6d99315ed017 (patch)
treee57e18523799b126f399ac4d77f67f220af8d793
parenta3c0a082f9fe84e007596646e544371fc4df277f (diff)
parentbcf0d1e08217a98830ee3838619d9802c8cc33f4 (diff)
downloadandroid_packages_apps_Trebuchet-2c99205461a3e752c5046a213d9b6d99315ed017.tar.gz
android_packages_apps_Trebuchet-2c99205461a3e752c5046a213d9b6d99315ed017.tar.bz2
android_packages_apps_Trebuchet-2c99205461a3e752c5046a213d9b6d99315ed017.zip
Merge "Reenabling switching between nav modes in tests" into ub-launcher3-qt-dev
-rw-r--r--quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java3
-rw-r--r--quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java3
-rw-r--r--tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java68
3 files changed, 1 insertions, 73 deletions
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index 960d907dc..20fdff2c5 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -44,7 +44,6 @@ import com.android.launcher3.tapl.LauncherInstrumentation;
import com.android.launcher3.testcomponent.TestCommandReceiver;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
@@ -98,7 +97,6 @@ public class FallbackRecentsTest {
@NavigationModeSwitch(mode = THREE_BUTTON)
@Test
- @Ignore // b/131630813
public void goToOverviewFromHome() {
mDevice.pressHome();
assertTrue("Fallback Launcher not visible", mDevice.wait(Until.hasObject(By.pkg(
@@ -109,7 +107,6 @@ public class FallbackRecentsTest {
@NavigationModeSwitch(mode = THREE_BUTTON)
@Test
- @Ignore // b/131630813
public void goToOverviewFromApp() {
startAppFast("com.android.settings");
diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
index 93e403cc8..e552f56ba 100644
--- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
+++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java
@@ -71,8 +71,7 @@ public class NavigationModeSwitchRule implements TestRule {
@Override
public Statement apply(Statement base, Description description) {
- // b/130558787; b/131419978
- if (false && TestHelpers.isInLauncherProcess() &&
+ if (TestHelpers.isInLauncherProcess() &&
description.getAnnotation(NavigationModeSwitch.class) != null) {
Mode mode = description.getAnnotation(NavigationModeSwitch.class).mode();
return new Statement() {
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 43bdb9f3f..75db2f19e 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -18,9 +18,6 @@ package com.android.launcher3.ui;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName;
-import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_2BUTTON_OVERLAY;
-import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_3BUTTON_OVERLAY;
-import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_GESTURAL_OVERLAY;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -35,7 +32,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.PackageManager;
-import android.os.Build;
import android.os.Process;
import android.os.RemoteException;
import android.util.Log;
@@ -64,7 +60,6 @@ import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestRule;
@@ -75,7 +70,6 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import java.lang.reflect.Method;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -111,68 +105,6 @@ public abstract class AbstractLauncherUiTest {
}
if (TestHelpers.isInLauncherProcess()) Utilities.enableRunningInTestHarnessForTests();
mLauncher = new LauncherInstrumentation(instrumentation);
-
- // b/130558787; b/131419978
- if (TestHelpers.isInLauncherProcess() && !LauncherInstrumentation.needSlowGestures()) {
- try {
- Class systemProps = Class.forName("android.os.SystemProperties");
- Method getInt = systemProps.getMethod("getInt", String.class, int.class);
- int apiLevel = (int) getInt.invoke(null, "ro.product.first_api_level", 0);
-
- if (apiLevel >= Build.VERSION_CODES.P) {
- setActiveOverlay(NAV_BAR_MODE_2BUTTON_OVERLAY,
- LauncherInstrumentation.NavigationModel.TWO_BUTTON);
- }
- if (apiLevel >= Build.VERSION_CODES.O && apiLevel < Build.VERSION_CODES.P) {
- setActiveOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY,
- LauncherInstrumentation.NavigationModel.ZERO_BUTTON);
- }
- if (apiLevel < Build.VERSION_CODES.O) {
- setActiveOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY,
- LauncherInstrumentation.NavigationModel.THREE_BUTTON);
- }
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- }
-
- public void setActiveOverlay(String overlayPackage,
- LauncherInstrumentation.NavigationModel expectedMode) {
- setOverlayPackageEnabled(NAV_BAR_MODE_3BUTTON_OVERLAY,
- overlayPackage == NAV_BAR_MODE_3BUTTON_OVERLAY);
- setOverlayPackageEnabled(NAV_BAR_MODE_2BUTTON_OVERLAY,
- overlayPackage == NAV_BAR_MODE_2BUTTON_OVERLAY);
- setOverlayPackageEnabled(NAV_BAR_MODE_GESTURAL_OVERLAY,
- overlayPackage == NAV_BAR_MODE_GESTURAL_OVERLAY);
-
- for (int i = 0; i != 100; ++i) {
- if (mLauncher.getNavigationModel() == expectedMode) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return;
- }
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- Assert.fail("Couldn't switch to " + overlayPackage);
- }
-
- private void setOverlayPackageEnabled(String overlayPackage, boolean enable) {
- Log.d(TAG, "setOverlayPackageEnabled: " + overlayPackage + " " + enable);
- final String action = enable ? "enable" : "disable";
- try {
- UiDevice.getInstance(getInstrumentation()).executeShellCommand(
- "cmd overlay " + action + " " + overlayPackage);
- } catch (IOException e) {
- e.printStackTrace();
- }
}
@Rule