diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-02-03 21:37:36 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-02-03 21:37:36 +0000 |
commit | b754d44b97b9dcf186af046e9d8ab0621e3a2d66 (patch) | |
tree | 8c5c834833bc0233726527635a9cf5aba61671e4 | |
parent | 42a101abe85d76de19e14df70ab26f943679c520 (diff) | |
parent | 70ac90a3774ea72330b8dbf9502ef64750db8d8c (diff) | |
download | cts-android11-mainline-release.tar.gz |
Merge cherrypicks of [13475365, 13475021] into mainline-releaseandroid-mainline-12.0.0_r55android-mainline-11.0.0_r7android-mainline-11.0.0_r45android-mainline-11.0.0_r33android11-mainline-release
Change-Id: I6d12c9c28a0aee2258819d395e5ac02ef7a46872
-rw-r--r-- | hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java index 4c99693f979..2e785f500f9 100644 --- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java +++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java @@ -21,6 +21,7 @@ import android.content.ContentResolver; import android.content.Intent; import android.content.IntentSender; import android.database.Cursor; +import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.SystemClock; @@ -118,8 +119,18 @@ public class DocumentsClientTest extends DocumentsClientTestCase { // Repeat swipe gesture to find our item // (UiScrollable#scrollIntoView does not seem to work well with SwipeRefreshLayout) UiObject targetObject = new UiObject(docList.childSelector(new UiSelector().text(label))); + UiObject saveButton = findSaveButton(); int stepLimit = 10; - while (!targetObject.exists() && stepLimit-- > 0) { + while (stepLimit-- > 0) { + if (targetObject.exists()) { + boolean targetObjectFullyVisible = !saveButton.exists() + || targetObject.getVisibleBounds().bottom + <= saveButton.getVisibleBounds().top; + if (targetObjectFullyVisible) { + break; + } + } + mDevice.swipe(/* startX= */ mDevice.getDisplayWidth() / 2, /* startY= */ mDevice.getDisplayHeight() / 2, /* endX= */ mDevice.getDisplayWidth() / 2, |