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

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

Issue 2670863004: 🏠 Add instrumentation test for Suggestions BottomSheet (Closed)
Patch Set: fix compilation, comments Created 3 years, 10 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
new file mode 100644
index 0000000000000000000000000000000000000000..afe9bd0e250270b42d07347b01843a2147a4a896
--- /dev/null
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestCaseBase.java
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.test;
+
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.test.util.CommandLineFlags;
+import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
+import org.chromium.chrome.browser.widget.BottomSheet;
+import org.chromium.chrome.browser.widget.BottomSheet.BottomSheetContent;
+
+/**
+ * Base class for instrumentation tests using the bottom sheet.
+ */
+@CommandLineFlags.Add({"enable-features=ChromeHome"})
+public abstract class BottomSheetTestCaseBase extends ChromeTabbedActivityTestBase {
+ @Override
+ protected void setUp() throws Exception {
+ ChromePreferenceManager.getInstance(getInstrumentation().getTargetContext())
+ .setChromeHomeEnabled(true);
+ super.setUp();
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ getActivity().getBottomSheet().setSheetState(
+ BottomSheet.SHEET_STATE_FULL, /* animate = */ false);
+ }
+ });
+ getInstrumentation().waitForIdleSync();
Michael van Ouwerkerk 2017/02/03 20:20:33 Could we wait for something more specific? Is ther
+ }
+
+ @Override
+ public void startMainActivity() throws InterruptedException {
+ startMainActivityOnBlankPage();
+ }
+
+ protected BottomSheetContent getBottomSheetContent() {
+ return getActivity().getBottomSheet().getCurrentSheetContent();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698