| Index: chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestCaseBase.java
|
| diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestCaseBase.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestCaseBase.java
|
| index 9997e61bd32c8a7b785b26ae69425f2c899b316e..3da8435e17bed7cbbb5e2c121ecf3c04b99c4fde 100644
|
| --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestCaseBase.java
|
| +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestCaseBase.java
|
| @@ -14,6 +14,7 @@ import org.chromium.base.test.util.Restriction;
|
| import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
|
| import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
|
| import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetContent;
|
| +import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContentController;
|
| import org.chromium.chrome.test.util.browser.RecyclerViewTestUtils;
|
|
|
| /**
|
| @@ -25,6 +26,9 @@ public abstract class BottomSheetTestCaseBase extends ChromeTabbedActivityTestBa
|
| /** A handle to the bottom sheet. */
|
| protected BottomSheet mBottomSheet;
|
|
|
| + /** A handle to the {@link BottomSheetContentController}. */
|
| + protected BottomSheetContentController mBottomSheetContentController;
|
| +
|
| private boolean mOldChromeHomeFlagValue;
|
| @Override
|
| protected void setUp() throws Exception {
|
| @@ -50,6 +54,7 @@ public abstract class BottomSheetTestCaseBase extends ChromeTabbedActivityTestBa
|
| ((RecyclerView) getBottomSheetContent().getContentView()));
|
|
|
| mBottomSheet = getActivity().getBottomSheet();
|
| + mBottomSheetContentController = getActivity().getBottomSheetContentController();
|
| }
|
|
|
| @Override
|
| @@ -93,4 +98,17 @@ public abstract class BottomSheetTestCaseBase extends ChromeTabbedActivityTestBa
|
| protected BottomSheetContent getBottomSheetContent() {
|
| return getActivity().getBottomSheet().getCurrentSheetContent();
|
| }
|
| +
|
| + /**
|
| + * @param itemId The id of the MenuItem corresponding to the {@link BottomSheetContent} to
|
| + * select.
|
| + */
|
| + protected void selectBottomSheetContent(final int itemId) {
|
| + ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + mBottomSheetContentController.selectItemForTests(itemId);
|
| + }
|
| + });
|
| + }
|
| }
|
|
|