Commit 43092e12 authored by Matt Jones's avatar Matt Jones Committed by Commit Bot

Make BottomSheet package protected

This patch makes the BottomSheet class protected. Accessors of the
view have been restricted to test methods. Most of the initialization
logic has been moved back into to BottomSheetController class with the
exception of the creation of the view and snackbar manager.

Bug: 986310, 1002277
Change-Id: I5e9cb255f89cd66add8fee93111cf09940be8452
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1910288
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715848}
parent a1b88bfa
...@@ -36,12 +36,12 @@ import org.chromium.base.Supplier; ...@@ -36,12 +36,12 @@ import org.chromium.base.Supplier;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager;
import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule;
import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils;
import org.chromium.chrome.browser.image_fetcher.ImageFetcher; import org.chromium.chrome.browser.image_fetcher.ImageFetcher;
import org.chromium.chrome.browser.image_fetcher.ImageFetcherConfig; import org.chromium.chrome.browser.image_fetcher.ImageFetcherConfig;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.Criteria;
...@@ -211,23 +211,21 @@ class AutofillAssistantUiTestUtil { ...@@ -211,23 +211,21 @@ class AutofillAssistantUiTestUtil {
static BottomSheetController createBottomSheetController(ChromeActivity activity) { static BottomSheetController createBottomSheetController(ChromeActivity activity) {
// Copied from {@link ChromeActivity#initializeBottomSheet}. // Copied from {@link ChromeActivity#initializeBottomSheet}.
Supplier<BottomSheet> sheetSupplier = () -> { Supplier<View> sheetSupplier = () -> {
ViewGroup coordinator = activity.findViewById(R.id.coordinator); ViewGroup coordinator = activity.findViewById(R.id.coordinator);
LayoutInflater.from(activity).inflate(R.layout.bottom_sheet, coordinator); LayoutInflater.from(activity).inflate(R.layout.bottom_sheet, coordinator);
BottomSheet bottomSheet = coordinator.findViewById(R.id.bottom_sheet); View bottomSheet = coordinator.findViewById(R.id.bottom_sheet);
bottomSheet.init(coordinator, activity.getActivityTabProvider(), activity.getWindow(),
activity.getWindowAndroid().getKeyboardDelegate());
return bottomSheet; return bottomSheet;
}; };
Supplier<OverlayPanelManager> panelManagerProvider = () -> {
return activity.getCompositorViewHolder().getLayoutManager().getOverlayPanelManager();
};
return new BottomSheetController(activity.getLifecycleDispatcher(), return new BottomSheetController(activity.getLifecycleDispatcher(),
activity.getActivityTabProvider(), activity.getScrim(), sheetSupplier, activity.getActivityTabProvider(), activity.getScrim(), sheetSupplier,
() panelManagerProvider, activity.getFullscreenManager(), activity.getWindow(),
-> activity.getCompositorViewHolder() activity.getWindowAndroid().getKeyboardDelegate());
.getLayoutManager()
.getOverlayPanelManager(),
activity.getFullscreenManager());
} }
/** /**
......
...@@ -161,7 +161,6 @@ import org.chromium.chrome.browser.vr.ArDelegateProvider; ...@@ -161,7 +161,6 @@ import org.chromium.chrome.browser.vr.ArDelegateProvider;
import org.chromium.chrome.browser.vr.VrModuleProvider; import org.chromium.chrome.browser.vr.VrModuleProvider;
import org.chromium.chrome.browser.webapps.addtohomescreen.AddToHomescreenManager; import org.chromium.chrome.browser.webapps.addtohomescreen.AddToHomescreenManager;
import org.chromium.chrome.browser.widget.ScrimView; import org.chromium.chrome.browser.widget.ScrimView;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController;
import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver; import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver;
...@@ -1427,16 +1426,15 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent> ...@@ -1427,16 +1426,15 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
} }
/** /**
* Initializes the {@link BottomSheetController}. The {@link BottomSheet} is only initialized * Initializes the {@link BottomSheetController}. The bottom sheet is only initialized after
* after content is requested for the first time. * content is requested for the first time.
*/ */
protected void initializeBottomSheetController() { protected void initializeBottomSheetController() {
Supplier<BottomSheet> sheetSupplier = () -> { Supplier<View> sheetViewSupplier = () -> {
ViewGroup coordinator = findViewById(R.id.coordinator); ViewGroup coordinator = findViewById(R.id.coordinator);
getLayoutInflater().inflate(R.layout.bottom_sheet, coordinator); getLayoutInflater().inflate(R.layout.bottom_sheet, coordinator);
BottomSheet sheet = coordinator.findViewById(R.id.bottom_sheet);
sheet.init(coordinator, getActivityTabProvider(), getWindow(), View sheet = coordinator.findViewById(R.id.bottom_sheet);
getWindowAndroid().getKeyboardDelegate());
mBottomSheetSnackbarManager = new SnackbarManager( mBottomSheetSnackbarManager = new SnackbarManager(
this, sheet.findViewById(R.id.bottom_sheet_snackbar_container)); this, sheet.findViewById(R.id.bottom_sheet_snackbar_container));
...@@ -1446,9 +1444,10 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent> ...@@ -1446,9 +1444,10 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
Supplier<OverlayPanelManager> panelManagerSupplier = Supplier<OverlayPanelManager> panelManagerSupplier =
() -> getCompositorViewHolder().getLayoutManager().getOverlayPanelManager(); () -> getCompositorViewHolder().getLayoutManager().getOverlayPanelManager();
mBottomSheetController =
new BottomSheetController(getLifecycleDispatcher(), mActivityTabProvider, mBottomSheetController = new BottomSheetController(getLifecycleDispatcher(),
mScrimView, sheetSupplier, panelManagerSupplier, getFullscreenManager()); mActivityTabProvider, mScrimView, sheetViewSupplier, panelManagerSupplier,
getFullscreenManager(), getWindow(), getWindowAndroid().getKeyboardDelegate());
((BottomContainer) findViewById(R.id.bottom_container)) ((BottomContainer) findViewById(R.id.bottom_container))
.setBottomSheetController(mBottomSheetController); .setBottomSheetController(mBottomSheetController);
......
...@@ -23,8 +23,8 @@ import org.chromium.chrome.browser.thinwebview.ThinWebView; ...@@ -23,8 +23,8 @@ import org.chromium.chrome.browser.thinwebview.ThinWebView;
import org.chromium.chrome.browser.thinwebview.ThinWebViewFactory; import org.chromium.chrome.browser.thinwebview.ThinWebViewFactory;
import org.chromium.chrome.browser.ui.widget.FadingShadow; import org.chromium.chrome.browser.ui.widget.FadingShadow;
import org.chromium.chrome.browser.ui.widget.FadingShadowView; import org.chromium.chrome.browser.ui.widget.FadingShadowView;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController;
import org.chromium.components.embedder_support.view.ContentView; import org.chromium.components.embedder_support.view.ContentView;
import org.chromium.components.url_formatter.UrlFormatter; import org.chromium.components.url_formatter.UrlFormatter;
import org.chromium.content_public.browser.RenderCoordinates; import org.chromium.content_public.browser.RenderCoordinates;
...@@ -143,7 +143,7 @@ public class EphemeralTabSheetContent implements BottomSheetContent { ...@@ -143,7 +143,7 @@ public class EphemeralTabSheetContent implements BottomSheetContent {
TransitionDrawable transitionDrawable = ApiCompatibilityUtils.createTransitionDrawable( TransitionDrawable transitionDrawable = ApiCompatibilityUtils.createTransitionDrawable(
new Drawable[] {mCurrentFavicon, favicon}); new Drawable[] {mCurrentFavicon, favicon});
transitionDrawable.setCrossFadeEnabled(true); transitionDrawable.setCrossFadeEnabled(true);
transitionDrawable.startTransition((int) BottomSheet.BASE_ANIMATION_DURATION_MS); transitionDrawable.startTransition(BottomSheetController.BASE_ANIMATION_DURATION_MS);
presentedDrawable = transitionDrawable; presentedDrawable = transitionDrawable;
} }
......
...@@ -52,15 +52,8 @@ import org.chromium.ui.KeyboardVisibilityDelegate; ...@@ -52,15 +52,8 @@ import org.chromium.ui.KeyboardVisibilityDelegate;
* All the computation in this file is based off of the bottom of the screen instead of the top * All the computation in this file is based off of the bottom of the screen instead of the top
* for simplicity. This means that the bottom of the screen is 0 on the Y axis. * for simplicity. This means that the bottom of the screen is 0 on the Y axis.
*/ */
public class BottomSheet class BottomSheet extends FrameLayout implements BottomSheetSwipeDetector.SwipeableBottomSheet,
extends FrameLayout implements BottomSheetSwipeDetector.SwipeableBottomSheet, NativePageHost, View.OnLayoutChangeListener {
NativePageHost, View.OnLayoutChangeListener {
/**
* The base duration of the settling animation of the sheet. 218 ms is a spec for material
* design (this is the minimum time a user is guaranteed to pay attention to something).
*/
public static final long BASE_ANIMATION_DURATION_MS = 218;
/** /**
* The fraction of the way to the next state the sheet must be swiped to animate there when * The fraction of the way to the next state the sheet must be swiped to animate there when
* released. This is the value used when there are 3 active states. A smaller value here means * released. This is the value used when there are 3 active states. A smaller value here means
...@@ -275,13 +268,13 @@ public class BottomSheet ...@@ -275,13 +268,13 @@ public class BottomSheet
* Adds layout change listeners to the views that the bottom sheet depends on. Namely the * Adds layout change listeners to the views that the bottom sheet depends on. Namely the
* heights of the root view and control container are important as they are used in many of the * heights of the root view and control container are important as they are used in many of the
* calculations in this class. * calculations in this class.
* @param root The container of the bottom sheet.
* @param tabProvider A means of accessing the active tab. * @param tabProvider A means of accessing the active tab.
* @param window Android window for getting insets. * @param window Android window for getting insets.
* @param keyboardDelegate Delegate for hiding the keyboard. * @param keyboardDelegate Delegate for hiding the keyboard.
*/ */
public void init(View root, ActivityTabProvider tabProvider, Window window, public void init(ActivityTabProvider tabProvider, Window window,
KeyboardVisibilityDelegate keyboardDelegate) { KeyboardVisibilityDelegate keyboardDelegate) {
View root = (View) getParent();
mTabSupplier = tabProvider; mTabSupplier = tabProvider;
mToolbarHolder = mToolbarHolder =
...@@ -609,7 +602,7 @@ public class BottomSheet ...@@ -609,7 +602,7 @@ public class BottomSheet
mTargetState = targetState; mTargetState = targetState;
mSettleAnimator = mSettleAnimator =
ValueAnimator.ofFloat(getCurrentOffsetPx(), getSheetHeightForState(targetState)); ValueAnimator.ofFloat(getCurrentOffsetPx(), getSheetHeightForState(targetState));
mSettleAnimator.setDuration(BASE_ANIMATION_DURATION_MS); mSettleAnimator.setDuration(BottomSheetController.BASE_ANIMATION_DURATION_MS);
mSettleAnimator.setInterpolator(mInterpolator); mSettleAnimator.setInterpolator(mInterpolator);
// When the animation is canceled or ends, reset the handle to null. // When the animation is canceled or ends, reset the handle to null.
...@@ -650,7 +643,7 @@ public class BottomSheet ...@@ -650,7 +643,7 @@ public class BottomSheet
* Sets the sheet's offset relative to the bottom of the screen. * Sets the sheet's offset relative to the bottom of the screen.
* @param offset The offset that the sheet should be. * @param offset The offset that the sheet should be.
*/ */
private void setSheetOffsetFromBottom(float offset, @StateChangeReason int reason) { void setSheetOffsetFromBottom(float offset, @StateChangeReason int reason) {
mCurrentOffsetPx = offset; mCurrentOffsetPx = offset;
// The browser controls offset is added here so that the sheet's toolbar behaves like the // The browser controls offset is added here so that the sheet's toolbar behaves like the
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.widget.bottomsheet; package org.chromium.chrome.browser.widget.bottomsheet;
import android.view.View; import android.view.View;
import android.view.Window;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
...@@ -27,6 +28,7 @@ import org.chromium.chrome.browser.vr.VrModuleProvider; ...@@ -27,6 +28,7 @@ import org.chromium.chrome.browser.vr.VrModuleProvider;
import org.chromium.chrome.browser.widget.ScrimView; import org.chromium.chrome.browser.widget.ScrimView;
import org.chromium.chrome.browser.widget.ScrimView.ScrimObserver; import org.chromium.chrome.browser.widget.ScrimView.ScrimObserver;
import org.chromium.chrome.browser.widget.ScrimView.ScrimParams; import org.chromium.chrome.browser.widget.ScrimView.ScrimParams;
import org.chromium.ui.KeyboardVisibilityDelegate;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -42,6 +44,12 @@ import java.util.PriorityQueue; ...@@ -42,6 +44,12 @@ import java.util.PriorityQueue;
* content was actually shown (see full doc on method). * content was actually shown (see full doc on method).
*/ */
public class BottomSheetController implements Destroyable { public class BottomSheetController implements Destroyable {
/**
* The base duration of the settling animation of the sheet. 218 ms is a spec for material
* design (this is the minimum time a user is guaranteed to pay attention to something).
*/
public static final int BASE_ANIMATION_DURATION_MS = 218;
/** The different states that the bottom sheet can have. */ /** The different states that the bottom sheet can have. */
@IntDef({SheetState.NONE, SheetState.HIDDEN, SheetState.PEEK, SheetState.HALF, SheetState.FULL, @IntDef({SheetState.NONE, SheetState.HIDDEN, SheetState.PEEK, SheetState.HALF, SheetState.FULL,
SheetState.SCROLLING}) SheetState.SCROLLING})
...@@ -141,15 +149,16 @@ public class BottomSheetController implements Destroyable { ...@@ -141,15 +149,16 @@ public class BottomSheetController implements Destroyable {
* @param lifecycleDispatcher The {@link ActivityLifecycleDispatcher} for the {@code activity}. * @param lifecycleDispatcher The {@link ActivityLifecycleDispatcher} for the {@code activity}.
* @param activityTabProvider The provider of the activity's current tab. * @param activityTabProvider The provider of the activity's current tab.
* @param scrim The scrim that shows when the bottom sheet is opened. * @param scrim The scrim that shows when the bottom sheet is opened.
* @param bottomSheetSupplier A mechanism for creating a {@link BottomSheet}. * @param bottomSheetViewSupplier A mechanism for creating a {@link BottomSheet}.
* @param overlayManager A supplier of the manager for overlay panels to attach listeners to. * @param overlayManager A supplier of the manager for overlay panels to attach listeners to.
* This is a supplier to get around wating for native to be initialized. * This is a supplier to get around wating for native to be initialized.
* @param fullscreenManager A fullscreen manager for access to browser controls offsets. * @param fullscreenManager A fullscreen manager for access to browser controls offsets.
*/ */
public BottomSheetController(final ActivityLifecycleDispatcher lifecycleDispatcher, public BottomSheetController(final ActivityLifecycleDispatcher lifecycleDispatcher,
final ActivityTabProvider activityTabProvider, final ScrimView scrim, final ActivityTabProvider activityTabProvider, final ScrimView scrim,
Supplier<BottomSheet> bottomSheetSupplier, Supplier<OverlayPanelManager> overlayManager, Supplier<View> bottomSheetViewSupplier, Supplier<OverlayPanelManager> overlayManager,
ChromeFullscreenManager fullscreenManager) { ChromeFullscreenManager fullscreenManager, Window window,
KeyboardVisibilityDelegate keyboardDelegate) {
mTabProvider = activityTabProvider; mTabProvider = activityTabProvider;
mOverlayPanelManager = overlayManager; mOverlayPanelManager = overlayManager;
mFullscreenManager = fullscreenManager; mFullscreenManager = fullscreenManager;
...@@ -215,7 +224,8 @@ public class BottomSheetController implements Destroyable { ...@@ -215,7 +224,8 @@ public class BottomSheetController implements Destroyable {
mFullscreenManager.addListener(mFullscreenListener); mFullscreenManager.addListener(mFullscreenListener);
mSheetInitializer = () -> { mSheetInitializer = () -> {
initializeSheet(lifecycleDispatcher, scrim, bottomSheetSupplier); initializeSheet(
lifecycleDispatcher, scrim, bottomSheetViewSupplier, window, keyboardDelegate);
}; };
} }
...@@ -223,11 +233,13 @@ public class BottomSheetController implements Destroyable { ...@@ -223,11 +233,13 @@ public class BottomSheetController implements Destroyable {
* Do the actual initialization of the bottom sheet. * Do the actual initialization of the bottom sheet.
* @param lifecycleDispatcher A means of binding to the activity's lifecycle. * @param lifecycleDispatcher A means of binding to the activity's lifecycle.
* @param scrim The scrim to show behind the sheet. * @param scrim The scrim to show behind the sheet.
* @param bottomSheetSupplier A means of creating the bottom sheet. * @param bottomSheetViewSupplier A means of creating the bottom sheet.
*/ */
private void initializeSheet(final ActivityLifecycleDispatcher lifecycleDispatcher, private void initializeSheet(final ActivityLifecycleDispatcher lifecycleDispatcher,
final ScrimView scrim, Supplier<BottomSheet> bottomSheetSupplier) { final ScrimView scrim, Supplier<View> bottomSheetViewSupplier, Window window,
mBottomSheet = bottomSheetSupplier.get(); KeyboardVisibilityDelegate keyboardDelegate) {
mBottomSheet = (BottomSheet) bottomSheetViewSupplier.get();
mBottomSheet.init(mTabProvider, window, keyboardDelegate);
// Initialize the queue with a comparator that checks content priority. // Initialize the queue with a comparator that checks content priority.
mContentQueue = new PriorityQueue<>(INITIAL_QUEUE_CAPACITY, mContentQueue = new PriorityQueue<>(INITIAL_QUEUE_CAPACITY,
...@@ -500,6 +512,16 @@ public class BottomSheetController implements Destroyable { ...@@ -500,6 +512,16 @@ public class BottomSheetController implements Destroyable {
return mBottomSheet; return mBottomSheet;
} }
/**
* This is the same as {@link BottomSheet#setSheetOffsetFromBottom(float, int)} but exclusively
* for testing.
* @param offset The offset to set the sheet to.
*/
@VisibleForTesting
public void setSheetOffsetFromBottomForTesting(float offset) {
mBottomSheet.setSheetOffsetFromBottom(offset, StateChangeReason.NONE);
}
/** /**
* Request that some content be shown in the bottom sheet. * Request that some content be shown in the bottom sheet.
* @param content The content to be shown in the bottom sheet. * @param content The content to be shown in the bottom sheet.
......
...@@ -22,7 +22,6 @@ import org.chromium.base.ThreadUtils; ...@@ -22,7 +22,6 @@ import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.util.MathUtils; import org.chromium.chrome.browser.util.MathUtils;
import org.chromium.chrome.test.BottomSheetTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.ui.test.util.UiRestriction; import org.chromium.ui.test.util.UiRestriction;
......
...@@ -113,7 +113,7 @@ android_library("chrome_java_test_support") { ...@@ -113,7 +113,7 @@ android_library("chrome_java_test_support") {
"javatests/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinatorTestUtils.java", "javatests/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinatorTestUtils.java",
"javatests/src/org/chromium/chrome/browser/tab/MockTab.java", "javatests/src/org/chromium/chrome/browser/tab/MockTab.java",
"javatests/src/org/chromium/chrome/browser/tab/TabTestUtils.java", "javatests/src/org/chromium/chrome/browser/tab/TabTestUtils.java",
"javatests/src/org/chromium/chrome/test/BottomSheetTestRule.java", "javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetTestRule.java",
"javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java", "javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java",
"javatests/src/org/chromium/chrome/test/ChromeBrowserTestRule.java", "javatests/src/org/chromium/chrome/test/ChromeBrowserTestRule.java",
"javatests/src/org/chromium/chrome/test/ChromeJUnit4ClassRunner.java", "javatests/src/org/chromium/chrome/test/ChromeJUnit4ClassRunner.java",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
package org.chromium.chrome.test; package org.chromium.chrome.browser.widget.bottomsheet;
import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
import static org.chromium.chrome.browser.ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE; import static org.chromium.chrome.browser.ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE;
...@@ -12,11 +12,8 @@ import android.support.test.uiautomator.UiDevice; ...@@ -12,11 +12,8 @@ import android.support.test.uiautomator.UiDevice;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController.StateChangeReason; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController.StateChangeReason;
import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
/** /**
...@@ -138,7 +135,7 @@ public class BottomSheetTestRule extends ChromeTabbedActivityTestRule { ...@@ -138,7 +135,7 @@ public class BottomSheetTestRule extends ChromeTabbedActivityTestRule {
*/ */
public void setSheetOffsetFromBottom(float offset) { public void setSheetOffsetFromBottom(float offset) {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> getBottomSheet().setSheetOffsetFromBottomForTesting(offset)); () -> mSheetController.setSheetOffsetFromBottomForTesting(offset));
} }
public BottomSheetContent getBottomSheetContent() { public BottomSheetContent getBottomSheetContent() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment