Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestCaseBase.java

Issue 2746013011: [Home] Add BottomSheetObserverTest#testSheetContentChanged (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e40916aff82b25abf605dc766f5dde3317520c08 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 bottom seet content controller. */
gone 2017/03/21 17:46:51 sheet, or use the real class name
Theresa 2017/03/21 22:29:25 Done.
+ 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.selectItem(itemId);
+ }
+ });
+ }
}

Powered by Google App Engine
This is Rietveld 408576698