diff options
Diffstat (limited to 'tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java')
-rw-r--r-- | tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java index 49b72549b7e..8bd1bb8fb33 100644 --- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java +++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java @@ -43,6 +43,9 @@ import android.content.res.Configuration; import android.support.test.uiautomator.By; import android.support.test.uiautomator.UiDevice; import android.support.test.uiautomator.UiObject2; +import android.support.test.uiautomator.UiObjectNotFoundException; +import android.support.test.uiautomator.UiScrollable; +import android.support.test.uiautomator.UiSelector; import android.support.test.uiautomator.Until; import android.util.Log; @@ -140,7 +143,7 @@ public class CtsSyncAccountAccessOtherCertTestCases { } catch (Throwable t) { if (scrollUps < 10) { // The notification we search for is below the fold, scroll to find it - swipeUp(uiDevice); + scrollNotifications(); scrollUps++; continue; } @@ -200,6 +203,18 @@ public class CtsSyncAccountAccessOtherCertTestCases { 50 /* numberOfSteps */); } + private boolean scrollNotifications() { + UiScrollable scrollable = new UiScrollable(new UiSelector().scrollable(true)); + if (!scrollable.exists()) { + return false; + } + try { + return scrollable.scrollForward(50); + } catch (UiObjectNotFoundException e) { + return false; + } + } + private boolean isRunningInVR() { final Context context = InstrumentationRegistry.getTargetContext(); return ((context.getResources().getConfiguration().uiMode & |