Loading tests/common/com/android/documentsui/bots/DirectoryListBot.java +1 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ public class DirectoryListBot extends Bots.BaseBot { public void assertHasMessageButtonText(String expected) throws UiObjectNotFoundException { UiObject button = findHeaderMessageButton(); String msg = String.valueOf(expected); assertEquals(msg, button.getText()); assertEquals(msg.toUpperCase(), button.getText().toUpperCase()); } public void clickMessageButton() throws UiObjectNotFoundException { Loading tests/common/com/android/documentsui/bots/GestureBot.java +6 −4 Original line number Diff line number Diff line Loading @@ -36,19 +36,21 @@ import android.view.MotionEvent.PointerProperties; * and making assertions against the state of it. */ public class GestureBot extends Bots.BaseBot { private static final String DIR_CONTAINER_ID = "com.android.documentsui:id/container_directory"; private static final String DIR_LIST_ID = "com.android.documentsui:id/dir_list"; private static final int LONGPRESS_STEPS = 60; private static final int TRAVELING_STEPS = 20; private static final int BAND_SELECTION_DEFAULT_STEPS = 100; private static final int STEPS_INBETWEEN_POINTS = 2; // Inserted after each motion event injection. private static final int MOTION_EVENT_INJECTION_DELAY_MILLIS = 5; private final String mDirContainerId; private final String mDirListId; private final UiAutomation mAutomation; private long mDownTime = 0; public GestureBot(UiDevice device, UiAutomation automation, Context context, int timeout) { super(device, context, timeout); mDirContainerId = mTargetPackage + ":id/container_directory"; mDirListId = mTargetPackage + ":id/dir_list"; mAutomation = automation; } Loading Loading @@ -89,8 +91,8 @@ public class GestureBot extends Bots.BaseBot { public UiObject findDocument(String label) throws UiObjectNotFoundException { final UiSelector docList = new UiSelector().resourceId( DIR_CONTAINER_ID).childSelector( new UiSelector().resourceId(DIR_LIST_ID)); mDirContainerId).childSelector( new UiSelector().resourceId(mDirListId)); // Wait for the first list item to appear new UiObject(docList.childSelector(new UiSelector())).waitForExists(mTimeout); Loading tests/common/com/android/documentsui/bots/InspectorBot.java +3 −3 Original line number Diff line number Diff line Loading @@ -42,9 +42,9 @@ public class InspectorBot extends Bots.BaseBot { public void assertTitle(String expected) throws Exception { UiSelector detailView = new UiSelector().resourceId("com.android.documentsui:id/inspector_details_view"); UiSelector textView = detailView.resourceId("com.android.documentsui:id/inspector_header_title"); new UiSelector().resourceId(mTargetPackage + ":id/inspector_details_view"); UiSelector textView = detailView.resourceId(mTargetPackage + ":id/inspector_header_title"); String text = mDevice.findObject(textView).getText(); assertEquals(expected, text); } Loading tests/common/com/android/documentsui/bots/UiBot.java +1 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ public class UiBot extends Bots.BaseBot { public boolean waitForActionModeBarToAppear() { UiObject2 bar = mDevice.wait(Until.findObject( By.res("com.android.documentsui:id/action_mode_bar")), mTimeout); By.res(mTargetPackage + ":id/action_mode_bar")), mTimeout); return (bar != null); } Loading tests/common/com/android/documentsui/services/TestNotificationService.java +15 −6 Original line number Diff line number Diff line Loading @@ -17,21 +17,21 @@ package com.android.documentsui.services; import android.app.Notification; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.BroadcastReceiver; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ProgressBar; import android.widget.RemoteViews; import android.util.Log; import androidx.test.InstrumentationRegistry; /** * This class receives a callback when Notification is posted or removed Loading Loading @@ -89,8 +89,7 @@ public class TestNotificationService extends NotificationListenerService { @Override public void onCreate() { mTargetPackageName = InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageName(); mTargetPackageName = getTargetPackageName(); mFrameLayout = new FrameLayout(getBaseContext()); IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_CHANGE_CANCEL_MODE); Loading Loading @@ -224,4 +223,14 @@ public class TestNotificationService extends NotificationListenerService { } return result; } private String getTargetPackageName() { final PackageManager pm = getPackageManager(); final Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); final ResolveInfo ri = pm.resolveActivity(intent, 0); return ri.activityInfo.packageName; } } Loading
tests/common/com/android/documentsui/bots/DirectoryListBot.java +1 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ public class DirectoryListBot extends Bots.BaseBot { public void assertHasMessageButtonText(String expected) throws UiObjectNotFoundException { UiObject button = findHeaderMessageButton(); String msg = String.valueOf(expected); assertEquals(msg, button.getText()); assertEquals(msg.toUpperCase(), button.getText().toUpperCase()); } public void clickMessageButton() throws UiObjectNotFoundException { Loading
tests/common/com/android/documentsui/bots/GestureBot.java +6 −4 Original line number Diff line number Diff line Loading @@ -36,19 +36,21 @@ import android.view.MotionEvent.PointerProperties; * and making assertions against the state of it. */ public class GestureBot extends Bots.BaseBot { private static final String DIR_CONTAINER_ID = "com.android.documentsui:id/container_directory"; private static final String DIR_LIST_ID = "com.android.documentsui:id/dir_list"; private static final int LONGPRESS_STEPS = 60; private static final int TRAVELING_STEPS = 20; private static final int BAND_SELECTION_DEFAULT_STEPS = 100; private static final int STEPS_INBETWEEN_POINTS = 2; // Inserted after each motion event injection. private static final int MOTION_EVENT_INJECTION_DELAY_MILLIS = 5; private final String mDirContainerId; private final String mDirListId; private final UiAutomation mAutomation; private long mDownTime = 0; public GestureBot(UiDevice device, UiAutomation automation, Context context, int timeout) { super(device, context, timeout); mDirContainerId = mTargetPackage + ":id/container_directory"; mDirListId = mTargetPackage + ":id/dir_list"; mAutomation = automation; } Loading Loading @@ -89,8 +91,8 @@ public class GestureBot extends Bots.BaseBot { public UiObject findDocument(String label) throws UiObjectNotFoundException { final UiSelector docList = new UiSelector().resourceId( DIR_CONTAINER_ID).childSelector( new UiSelector().resourceId(DIR_LIST_ID)); mDirContainerId).childSelector( new UiSelector().resourceId(mDirListId)); // Wait for the first list item to appear new UiObject(docList.childSelector(new UiSelector())).waitForExists(mTimeout); Loading
tests/common/com/android/documentsui/bots/InspectorBot.java +3 −3 Original line number Diff line number Diff line Loading @@ -42,9 +42,9 @@ public class InspectorBot extends Bots.BaseBot { public void assertTitle(String expected) throws Exception { UiSelector detailView = new UiSelector().resourceId("com.android.documentsui:id/inspector_details_view"); UiSelector textView = detailView.resourceId("com.android.documentsui:id/inspector_header_title"); new UiSelector().resourceId(mTargetPackage + ":id/inspector_details_view"); UiSelector textView = detailView.resourceId(mTargetPackage + ":id/inspector_header_title"); String text = mDevice.findObject(textView).getText(); assertEquals(expected, text); } Loading
tests/common/com/android/documentsui/bots/UiBot.java +1 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ public class UiBot extends Bots.BaseBot { public boolean waitForActionModeBarToAppear() { UiObject2 bar = mDevice.wait(Until.findObject( By.res("com.android.documentsui:id/action_mode_bar")), mTimeout); By.res(mTargetPackage + ":id/action_mode_bar")), mTimeout); return (bar != null); } Loading
tests/common/com/android/documentsui/services/TestNotificationService.java +15 −6 Original line number Diff line number Diff line Loading @@ -17,21 +17,21 @@ package com.android.documentsui.services; import android.app.Notification; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.BroadcastReceiver; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ProgressBar; import android.widget.RemoteViews; import android.util.Log; import androidx.test.InstrumentationRegistry; /** * This class receives a callback when Notification is posted or removed Loading Loading @@ -89,8 +89,7 @@ public class TestNotificationService extends NotificationListenerService { @Override public void onCreate() { mTargetPackageName = InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageName(); mTargetPackageName = getTargetPackageName(); mFrameLayout = new FrameLayout(getBaseContext()); IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_CHANGE_CANCEL_MODE); Loading Loading @@ -224,4 +223,14 @@ public class TestNotificationService extends NotificationListenerService { } return result; } private String getTargetPackageName() { final PackageManager pm = getPackageManager(); final Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); final ResolveInfo ri = pm.resolveActivity(intent, 0); return ri.activityInfo.packageName; } }