Chromium Code Reviews| 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..810cf0b8b9005de62e5066cc25623f57ae04ea40 |
| --- /dev/null |
| +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestCaseBase.java |
| @@ -0,0 +1,43 @@ |
| +// 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; |
| +import org.chromium.chrome.test.util.browser.RecyclerViewTestUtils; |
| + |
| +/** |
| + * 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); |
|
Michael van Ouwerkerk
2017/02/07 11:12:41
Why do we need both this and " @CommandLineFlags.A
dgn
2017/02/13 14:25:39
I looked more into why I needed this. There is an
|
| + super.setUp(); |
| + ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| + @Override |
| + public void run() { |
| + getActivity().getBottomSheet().setSheetState( |
| + BottomSheet.SHEET_STATE_FULL, /* animate = */ false); |
| + } |
| + }); |
| + RecyclerViewTestUtils.waitForStableRecyclerView( |
| + getBottomSheetContent().getScrollingContentView()); |
| + } |
| + |
| + @Override |
| + public void startMainActivity() throws InterruptedException { |
| + startMainActivityOnBlankPage(); |
| + } |
| + |
| + protected BottomSheetContent getBottomSheetContent() { |
| + return getActivity().getBottomSheet().getCurrentSheetContent(); |
| + } |
| +} |