summaryrefslogtreecommitdiff
path: root/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java')
-rw-r--r--hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java b/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java
index b3d1d1c4970..56d2e0723df 100644
--- a/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java
+++ b/hostsidetests/appsecurity/test-apps/MediaStorageApp/src/com/android/cts/mediastorageapp/MediaStorageTest.java
@@ -996,12 +996,7 @@ public class MediaStorageTest {
// to keep rolling forward if we can't find our grant button
final UiSelector grant = new UiSelector().textMatches("(?i)Allow");
if (isWatch()) {
- UiScrollable uiScrollable = new UiScrollable(new UiSelector().scrollable(true));
- try {
- uiScrollable.scrollIntoView(grant);
- } catch (UiObjectNotFoundException e) {
- // Scrolling can fail if the UI is not scrollable
- }
+ scrollIntoView(grant);
}
final boolean grantExists = new UiObject(grant).waitForExists(timeout);
@@ -1016,8 +1011,11 @@ public class MediaStorageTest {
// Verify that we now have access
assertEquals(Activity.RESULT_OK, res.resultCode);
} else {
- // fine the Deny button
+ // find the Deny button
final UiSelector deny = new UiSelector().textMatches("(?i)Deny");
+ if (isWatch()) {
+ scrollIntoView(deny);
+ }
final boolean denyExists = new UiObject(deny).waitForExists(timeout);
assertThat(denyExists).isTrue();
@@ -1030,6 +1028,15 @@ public class MediaStorageTest {
}
}
+ private static void scrollIntoView(UiSelector selector) {
+ UiScrollable uiScrollable = new UiScrollable(new UiSelector().scrollable(true));
+ try {
+ uiScrollable.scrollIntoView(selector);
+ } catch (UiObjectNotFoundException e) {
+ // Scrolling can fail if the UI is not scrollable
+ }
+ }
+
private static Uri createDownload() throws IOException {
final String content = "<html><body>Content</body></html>";
final String displayName = "cts" + System.nanoTime();