diff options
author | Vadim Tryshev <vadimt@google.com> | 2019-04-04 17:36:46 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-04-04 17:36:46 +0000 |
commit | 077df72acca237385f52b3557b70c30e3cb5d0b9 (patch) | |
tree | 57c017f5771165e34390d0ceed232c8adc1e7cf6 /tests | |
parent | 8404669d6bda0d813c70cb905efba5da7d198971 (diff) | |
parent | 471115589eb2647ca4962cc6f5dce0653f0b9a78 (diff) | |
download | android_packages_apps_Trebuchet-077df72acca237385f52b3557b70c30e3cb5d0b9.tar.gz android_packages_apps_Trebuchet-077df72acca237385f52b3557b70c30e3cb5d0b9.tar.bz2 android_packages_apps_Trebuchet-077df72acca237385f52b3557b70c30e3cb5d0b9.zip |
Merge "Diagnosing phone locked state in TAPL" into ub-launcher3-master
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index a4b417192..ef3cb1f8d 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -36,6 +36,7 @@ import android.view.MotionEvent; import android.view.Surface; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.test.uiautomator.By; @@ -44,15 +45,18 @@ import androidx.test.uiautomator.Configurator; import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; + import com.android.launcher3.TestProtocol; import com.android.systemui.shared.system.QuickStepContract; + +import org.junit.Assert; + import java.io.IOException; import java.lang.ref.WeakReference; import java.util.Deque; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeoutException; -import org.junit.Assert; /** * The main tapl object. The only object that can be explicitly constructed by the using code. It @@ -149,6 +153,8 @@ public final class LauncherInstrumentation { } catch (IOException e) { fail(e.toString()); } + + assertTrue("Phone is locked", !hasSystemUiObject("keyguard_status_view")); } Context getContext() { @@ -245,10 +251,10 @@ public final class LauncherInstrumentation { final NavigationModel navigationModel = getNavigationModel(); assertTrue("Presence of recents button doesn't match the interaction mode", (navigationModel == NavigationModel.THREE_BUTTON) == - mDevice.hasObject(By.res(SYSTEMUI_PACKAGE, "recent_apps"))); + hasSystemUiObject("recent_apps")); assertTrue("Presence of home button doesn't match the interaction mode", (navigationModel != NavigationModel.ZERO_BUTTON) == - mDevice.hasObject(By.res(SYSTEMUI_PACKAGE, "home"))); + hasSystemUiObject("home")); log("verifyContainerType: " + containerType); try (Closable c = addContextLayer( @@ -477,6 +483,10 @@ public final class LauncherInstrumentation { WAIT_TIME_MS)); } + private boolean hasSystemUiObject(String resId) { + return mDevice.hasObject(By.res(SYSTEMUI_PACKAGE, resId)); + } + @NonNull UiObject2 waitForSystemUiObject(String resId) { final UiObject2 object = mDevice.wait( |