Commit ed3219e6 authored by Yue Zhang's avatar Yue Zhang Committed by Commit Bot

Remove PopupWindow usage in TabGridDialog

Currently, TabGridDialog component uses PopupWindow as a container which
has shown some disadvantages as feature evolves (https://docs.google.com/document/d/1z49-ehX2VzoY_KcMUOSDi3FU7NzqLlrQocD_M-bPZ1A/edit?usp=sharing)
This CL removes the PopupWindow usage in TabGridDialog. Things happened
in this CL:
* Instead of using PopupWindow as a container, we insert the inflated
  view into the root view hierarchy and make all TabGridDialog instances
  share this same view.
* Use the ScrimView in RootUiCoordinator instead of creating a new one.
  This gives us a bonus that the scrim now covers the status bar.
* Tweaks in TabGridDialogMediator to make sure the component behaves the
  same before/after.
* Fix tests to adapt to change that TabGridDialog is not in a separate
  window.

Bug: 1069803, 1064140, 997239
Change-Id: I1da2db2bf7ef5b8f304782c4bcc95e951b23623b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2119188
Commit-Queue: Yue Zhang <yuezhanggg@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarMei Liang <meiliang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771898}
parent 678e108d
......@@ -12,6 +12,7 @@ import static android.support.test.espresso.assertion.ViewAssertions.doesNotExis
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
import static android.support.test.espresso.matcher.ViewMatchers.Visibility.GONE;
import static android.support.test.espresso.matcher.ViewMatchers.Visibility.VISIBLE;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
......@@ -1364,7 +1365,8 @@ public class StartSurfaceLayoutTest {
prepareTabs(1, 0, null);
enterGTSWithThumbnailChecking();
onView(allOf(withId(R.id.action_button), withParent(withId(R.id.content_view))))
onView(allOf(withId(R.id.action_button), withParent(withId(R.id.content_view)),
withEffectiveVisibility(VISIBLE)))
.perform(click());
}
......
......@@ -117,7 +117,7 @@ android_library("java") {
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMenuCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMenuItemBinder.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMenuItemProperties.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogParent.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogView.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridIphDialogCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridIphDialogView.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridItemTouchHelperCallback.java",
......
......@@ -3,7 +3,7 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<FrameLayout
<org.chromium.chrome.browser.tasks.tab_management.TabGridDialogView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
......@@ -58,4 +58,4 @@
android:alpha="0.0">
<include layout="@layout/tab_grid_card_item"/>
</FrameLayout>
</FrameLayout>
\ No newline at end of file
</org.chromium.chrome.browser.tasks.tab_management.TabGridDialogView>
\ No newline at end of file
......@@ -15,6 +15,7 @@ import androidx.annotation.Nullable;
import org.chromium.base.SysUtils;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.base.supplier.ObservableSupplier;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.tab.Tab;
......@@ -37,10 +38,9 @@ public class TabGridDialogCoordinator implements TabGridDialogMediator.DialogCon
private final TabGridDialogMediator mMediator;
private final PropertyModel mModel;
private final PropertyModelChangeProcessor mModelChangeProcessor;
private final TabGridDialogParent mParentLayout;
private TabSelectionEditorCoordinator mTabSelectionEditorCoordinator;
private ViewGroup mContainerView;
private TabGridDialogView mDialogView;
private boolean mIsInitialized;
TabGridDialogCoordinator(Context context, TabModelSelector tabModelSelector,
......@@ -55,7 +55,13 @@ public class TabGridDialogCoordinator implements TabGridDialogMediator.DialogCon
mModel = new PropertyModel(TabGridPanelProperties.ALL_KEYS);
mContainerView = containerView;
mParentLayout = new TabGridDialogParent(context, containerView);
mDialogView = containerView.findViewById(R.id.dialog_parent_view);
if (mDialogView == null) {
LayoutInflater.from(context).inflate(
R.layout.tab_grid_dialog_layout, containerView, true);
mDialogView = containerView.findViewById(R.id.dialog_parent_view);
mDialogView.setupScrimView(((ChromeActivity) context).getScrim());
}
mMediator = new TabGridDialogMediator(context, this, mModel, tabModelSelector,
tabCreatorManager, resetHandler, animationSourceViewProvider, shareDelegateSupplier,
......@@ -81,7 +87,7 @@ public class TabGridDialogCoordinator implements TabGridDialogMediator.DialogCon
toolbarView.hideTabGroupsContinuationWidgets();
}
mModelChangeProcessor = PropertyModelChangeProcessor.create(mModel,
new TabGridPanelViewBinder.ViewHolder(toolbarView, recyclerView, mParentLayout),
new TabGridPanelViewBinder.ViewHolder(toolbarView, recyclerView, mDialogView),
TabGridPanelViewBinder::bind);
}
......@@ -95,7 +101,7 @@ public class TabGridDialogCoordinator implements TabGridDialogMediator.DialogCon
int mode = SysUtils.isLowEndDevice() ? TabListCoordinator.TabListMode.LIST
: TabListCoordinator.TabListMode.GRID;
mTabSelectionEditorCoordinator = new TabSelectionEditorCoordinator(context,
mContainerView, tabModelSelector, tabContentManager, mParentLayout, mode);
mContainerView, tabModelSelector, tabContentManager, mDialogView, mode);
controller = mTabSelectionEditorCoordinator.getController();
} else {
......@@ -111,7 +117,6 @@ public class TabGridDialogCoordinator implements TabGridDialogMediator.DialogCon
public void destroy() {
mTabListCoordinator.destroy();
mMediator.destroy();
mParentLayout.destroy();
mModelChangeProcessor.destroy();
if (mTabSelectionEditorCoordinator != null) {
mTabSelectionEditorCoordinator.destroy();
......
......@@ -99,6 +99,7 @@ public class TabGridDialogMediator {
private final AnimationSourceViewProvider mAnimationSourceViewProvider;
private final DialogHandler mTabGridDialogHandler;
private final ObservableSupplier<ShareDelegate> mShareDelegateSupplier;
private final ScrimView.ScrimObserver mScrimObserver;
private final String mComponentName;
private TabGroupTitleEditor mTabGroupTitleEditor;
......@@ -206,6 +207,19 @@ public class TabGridDialogMediator {
}
};
mTabModelSelector.addObserver(mTabModelSelectorObserver);
// Setup ScrimView observer.
mScrimObserver = new ScrimView.ScrimObserver() {
@Override
public void onScrimClick() {
mModel.set(TabGridPanelProperties.IS_KEYBOARD_VISIBLE, false);
mModel.set(TabGridPanelProperties.IS_TITLE_TEXT_FOCUSED, false);
hideDialog(true);
RecordUserAction.record("TabGridDialog.Exit");
}
@Override
public void onScrimVisibilityChanged(boolean visible) {}
};
}
public void initWithNative(@Nullable TabSelectionEditorCoordinator
......@@ -219,7 +233,8 @@ public class TabGridDialogMediator {
mToolbarMenuCallback = result -> {
if (result == R.id.ungroup_tab) {
mModel.set(TabGridPanelProperties.IS_POPUP_WINDOW_FOCUSABLE, false);
mModel.set(TabGridPanelProperties.IS_KEYBOARD_VISIBLE, false);
mModel.set(TabGridPanelProperties.IS_TITLE_TEXT_FOCUSED, false);
List<Tab> tabs = getRelatedTabs(mCurrentTabId);
if (mTabSelectionEditorController != null) {
mTabSelectionEditorController.show(tabs);
......@@ -258,9 +273,6 @@ public class TabGridDialogMediator {
setupDialogSelectionEditor();
mModel.set(TabGridPanelProperties.MENU_CLICK_LISTENER, getMenuButtonClickListener());
}
// Setup ScrimView observer.
setupScrimViewObserver();
}
void hideDialog(boolean showAnimation) {
......@@ -297,6 +309,7 @@ public class TabGridDialogMediator {
}
updateDialog();
updateDialogScrollPosition();
mModel.set(TabGridPanelProperties.SCRIMVIEW_OBSERVER, mScrimObserver);
mModel.set(TabGridPanelProperties.IS_DIALOG_VISIBLE, true);
} else {
mModel.set(TabGridPanelProperties.IS_DIALOG_VISIBLE, false);
......@@ -385,9 +398,9 @@ public class TabGridDialogMediator {
mKeyboardVisibilityListener = isShowing -> {
mModel.set(TabGridPanelProperties.TITLE_CURSOR_VISIBILITY, isShowing);
mModel.set(TabGridPanelProperties.IS_TITLE_TEXT_FOCUSED, isShowing);
mModel.set(TabGridPanelProperties.IS_KEYBOARD_VISIBLE, isShowing);
if (!isShowing) {
saveCurrentGroupModifiedTitle();
mModel.set(TabGridPanelProperties.IS_POPUP_WINDOW_FOCUSABLE, false);
}
};
KeyboardVisibilityDelegate.getInstance().addKeyboardVisibilityListener(
......@@ -411,31 +424,11 @@ public class TabGridDialogMediator {
View.OnFocusChangeListener onFocusChangeListener =
(v, hasFocus) -> mIsUpdatingTitle = hasFocus;
mModel.set(TabGridPanelProperties.TITLE_TEXT_ON_FOCUS_LISTENER, onFocusChangeListener);
View.OnTouchListener onTouchListener = (v, event) -> {
// When touching title text field, make the PopupWindow focusable and request focus.
mModel.set(TabGridPanelProperties.IS_POPUP_WINDOW_FOCUSABLE, true);
v.performClick();
return false;
};
mModel.set(TabGridPanelProperties.TITLE_TEXT_ON_TOUCH_LISTENER, onTouchListener);
}
private void setupScrimViewObserver() {
ScrimView.ScrimObserver scrimObserver = new ScrimView.ScrimObserver() {
@Override
public void onScrimClick() {
hideDialog(true);
RecordUserAction.record("TabGridDialog.Exit");
}
@Override
public void onScrimVisibilityChanged(boolean visible) {}
};
mModel.set(TabGridPanelProperties.SCRIMVIEW_OBSERVER, scrimObserver);
}
private View.OnClickListener getCollapseButtonClickListener() {
return view -> {
mModel.set(TabGridPanelProperties.IS_KEYBOARD_VISIBLE, false);
hideDialog(true);
RecordUserAction.record("TabGridDialog.Exit");
};
......@@ -517,7 +510,7 @@ public class TabGridDialogMediator {
*/
class DialogHandler implements TabListMediator.TabGridDialogHandler {
@Override
public void updateUngroupBarStatus(@TabGridDialogParent.UngroupBarStatus int status) {
public void updateUngroupBarStatus(@TabGridDialogView.UngroupBarStatus int status) {
mModel.set(TabGridPanelProperties.UNGROUP_BAR_STATUS, status);
}
......@@ -573,4 +566,9 @@ public class TabGridDialogMediator {
Callback<Integer> getToolbarMenuCallbackForTesting() {
return mToolbarMenuCallback;
}
@VisibleForTesting
ScrimView.ScrimObserver getScrimObserverForTesting() {
return mScrimObserver;
}
}
......@@ -236,7 +236,7 @@ public class TabGridItemTouchHelperCallback extends ItemTouchHelper.SimpleCallba
mUnGroupTabIndex = TabModel.INVALID_TAB_INDEX;
if (mTabGridDialogHandler != null) {
mTabGridDialogHandler.updateUngroupBarStatus(
TabGridDialogParent.UngroupBarStatus.HIDE);
TabGridDialogView.UngroupBarStatus.HIDE);
}
}
}
......@@ -317,10 +317,10 @@ public class TabGridItemTouchHelperCallback extends ItemTouchHelper.SimpleCallba
mUnGroupTabIndex = isHoveredOnUngroupBar ? viewHolder.getAdapterPosition()
: TabModel.INVALID_TAB_INDEX;
mTabGridDialogHandler.updateUngroupBarStatus(isHoveredOnUngroupBar
? TabGridDialogParent.UngroupBarStatus.HOVERED
? TabGridDialogView.UngroupBarStatus.HOVERED
: (mSelectedTabIndex == TabModel.INVALID_TAB_INDEX
? TabGridDialogParent.UngroupBarStatus.HIDE
: TabGridDialogParent.UngroupBarStatus.SHOW));
? TabGridDialogView.UngroupBarStatus.HIDE
: TabGridDialogView.UngroupBarStatus.SHOW));
}
}
......
......@@ -35,7 +35,7 @@ class TabGridPanelProperties {
new PropertyModel.WritableBooleanPropertyKey();
public static final PropertyModel
.WritableObjectPropertyKey<ScrimView.ScrimObserver> SCRIMVIEW_OBSERVER =
new PropertyModel.WritableObjectPropertyKey<>();
new PropertyModel.WritableObjectPropertyKey<>(true);
public static final PropertyModel.WritableObjectPropertyKey<View> ANIMATION_SOURCE_VIEW =
new PropertyModel.WritableObjectPropertyKey<>(true);
public static final PropertyModel.WritableIntPropertyKey UNGROUP_BAR_STATUS =
......@@ -70,11 +70,8 @@ class TabGridPanelProperties {
new PropertyModel.WritableBooleanPropertyKey();
public static final PropertyModel.WritableBooleanPropertyKey IS_TITLE_TEXT_FOCUSED =
new PropertyModel.WritableBooleanPropertyKey();
public static final PropertyModel.WritableBooleanPropertyKey IS_POPUP_WINDOW_FOCUSABLE =
public static final PropertyModel.WritableBooleanPropertyKey IS_KEYBOARD_VISIBLE =
new PropertyModel.WritableBooleanPropertyKey();
public static final PropertyModel
.WritableObjectPropertyKey<View.OnTouchListener> TITLE_TEXT_ON_TOUCH_LISTENER =
new PropertyModel.WritableObjectPropertyKey<View.OnTouchListener>();
public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {COLLAPSE_CLICK_LISTENER,
ADD_CLICK_LISTENER, HEADER_TITLE, CONTENT_TOP_MARGIN, PRIMARY_COLOR, TINT,
IS_DIALOG_VISIBLE, SCRIMVIEW_OBSERVER, ANIMATION_SOURCE_VIEW, UNGROUP_BAR_STATUS,
......@@ -82,5 +79,5 @@ class TabGridPanelProperties {
DIALOG_UNGROUP_BAR_HOVERED_BACKGROUND_COLOR_ID, DIALOG_UNGROUP_BAR_TEXT_APPEARANCE,
INITIAL_SCROLL_INDEX, IS_MAIN_CONTENT_VISIBLE, MENU_CLICK_LISTENER, TITLE_TEXT_WATCHER,
TITLE_TEXT_ON_FOCUS_LISTENER, TITLE_CURSOR_VISIBILITY, IS_TITLE_TEXT_FOCUSED,
IS_POPUP_WINDOW_FOCUSABLE, TITLE_TEXT_ON_TOUCH_LISTENER};
IS_KEYBOARD_VISIBLE};
}
......@@ -15,8 +15,8 @@ import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelPrope
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.HEADER_TITLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.INITIAL_SCROLL_INDEX;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.IS_DIALOG_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.IS_KEYBOARD_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.IS_MAIN_CONTENT_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.IS_POPUP_WINDOW_FOCUSABLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.IS_TITLE_TEXT_FOCUSED;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.MENU_CLICK_LISTENER;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.PRIMARY_COLOR;
......@@ -24,7 +24,6 @@ import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelPrope
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.TINT;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.TITLE_CURSOR_VISIBILITY;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.TITLE_TEXT_ON_FOCUS_LISTENER;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.TITLE_TEXT_ON_TOUCH_LISTENER;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.TITLE_TEXT_WATCHER;
import static org.chromium.chrome.browser.tasks.tab_management.TabGridPanelProperties.UNGROUP_BAR_STATUS;
......@@ -49,10 +48,10 @@ class TabGridPanelViewBinder {
public final TabGroupUiToolbarView toolbarView;
public final RecyclerView contentView;
@Nullable
public TabGridDialogParent dialogView;
public TabGridDialogView dialogView;
ViewHolder(TabGroupUiToolbarView toolbarView, RecyclerView contentView,
@Nullable TabGridDialogParent dialogView) {
@Nullable TabGridDialogView dialogView) {
this.toolbarView = toolbarView;
this.contentView = contentView;
this.dialogView = dialogView;
......@@ -135,10 +134,11 @@ class TabGridPanelViewBinder {
if (!model.get(IS_TITLE_TEXT_FOCUSED)) {
viewHolder.toolbarView.clearTitleTextFocus();
}
} else if (IS_POPUP_WINDOW_FOCUSABLE == propertyKey) {
viewHolder.dialogView.setPopupWindowFocusable(model.get(IS_POPUP_WINDOW_FOCUSABLE));
} else if (TITLE_TEXT_ON_TOUCH_LISTENER == propertyKey) {
viewHolder.toolbarView.setTitleOnTouchListener(model.get(TITLE_TEXT_ON_TOUCH_LISTENER));
} else if (IS_KEYBOARD_VISIBLE == propertyKey) {
// Don't explicitly show keyboard since it should happen automatically.
if (!model.get(IS_KEYBOARD_VISIBLE)) {
viewHolder.toolbarView.hideKeyboard();
}
}
}
}
......@@ -101,8 +101,8 @@ public class TabGroupUiCoordinator implements TabGroupUiMediator.ResetHandler, T
TabGridDialogMediator.DialogController dialogController = null;
if (TabUiFeatureUtilities.isTabGroupsAndroidEnabled()) {
mTabGridDialogCoordinator = new TabGridDialogCoordinator(mContext, tabModelSelector,
tabContentManager, activity, activity.getCompositorViewHolder(), null, null,
null, mActivity.getShareDelegateSupplier());
tabContentManager, activity, activity.findViewById(R.id.coordinator), null,
null, null, mActivity.getShareDelegateSupplier());
mTabGridDialogCoordinator.initWithNative(mContext, tabModelSelector, tabContentManager,
mTabStripCoordinator.getTabGroupTitleEditor());
dialogController = mTabGridDialogCoordinator.getDialogController();
......
......@@ -21,6 +21,7 @@ import androidx.core.widget.TextViewCompat;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.tab_ui.R;
import org.chromium.ui.KeyboardVisibilityDelegate;
import org.chromium.ui.widget.ChromeImageView;
/**
......@@ -83,8 +84,9 @@ public class TabGroupUiToolbarView extends FrameLayout {
mTitleTextView.clearFocus();
}
void setTitleOnTouchListener(View.OnTouchListener listener) {
mTitleTextView.setOnTouchListener(listener);
void hideKeyboard() {
KeyboardVisibilityDelegate delegate = KeyboardVisibilityDelegate.getInstance();
delegate.hideKeyboard(this);
}
ViewGroup getViewContainer() {
......
......@@ -117,10 +117,10 @@ class TabListMediator {
/**
* This method updates the status of the ungroup bar in TabGridDialog.
*
* @param status The status in {@link TabGridDialogParent.UngroupBarStatus} that the ungroup
* @param status The status in {@link TabGridDialogView.UngroupBarStatus} that the ungroup
* bar should be updated to.
*/
void updateUngroupBarStatus(@TabGridDialogParent.UngroupBarStatus int status);
void updateUngroupBarStatus(@TabGridDialogView.UngroupBarStatus int status);
/**
* This method updates the content of the TabGridDialog.
......
......@@ -171,9 +171,8 @@ public class TabSwitcherCoordinator
if (TabUiFeatureUtilities.isTabGroupsAndroidEnabled()) {
mTabGridDialogCoordinator = new TabGridDialogCoordinator(context, tabModelSelector,
tabContentManager, tabCreatorManager,
((ChromeTabbedActivity) context).getCompositorViewHolder(), this, mMediator,
this::getTabGridDialogAnimationSourceView, shareDelegateSupplier);
((ChromeTabbedActivity) context).findViewById(R.id.coordinator), this,
mMediator, this::getTabGridDialogAnimationSourceView, shareDelegateSupplier);
mMediator.setTabGridDialogController(mTabGridDialogCoordinator.getDialogController());
} else {
mTabGridDialogCoordinator = null;
......@@ -381,7 +380,7 @@ public class TabSwitcherCoordinator
@Override
@VisibleForTesting
public void setSourceRectCallbackForTesting(Callback<RectF> callback) {
TabGridDialogParent.setSourceRectCallbackForTesting(callback);
TabGridDialogView.setSourceRectCallbackForTesting(callback);
}
// ResetHandler implementation.
......
......@@ -179,7 +179,7 @@ public class TabGroupPopupUiTest {
// Re-verify that tab strip never shows in single tab.
clickFirstCardFromTabSwitcher(cta);
closeFirstTabInDialog(cta);
closeFirstTabInDialog();
clickFirstTabInDialog(cta);
CriteriaHelper.pollInstrumentationThread(() -> isTabStripHidden(cta));
triggerTabStripAndVerify(cta, 0);
......
......@@ -6,6 +6,8 @@ package org.chromium.chrome.browser.tasks.tab_management;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.Visibility.VISIBLE;
import static android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
......@@ -150,7 +152,8 @@ public class TabGroupUiTest {
// Disable animation to reduce flakiness.
stripRecyclerView.setItemAnimator(null);
});
onView(allOf(withId(R.id.toolbar_right_button), withParent(withId(R.id.main_content))))
onView(allOf(withId(R.id.toolbar_right_button), withParent(withId(R.id.main_content)),
withEffectiveVisibility(VISIBLE)))
.perform(click());
mRenderTestRule.render(recyclerViewReference.get(), "11th_tab_selected");
}
......
......@@ -159,8 +159,7 @@ public class TabUiTestHelper {
*/
static void clickNthTabInDialog(ChromeTabbedActivity cta, int index) {
OverviewModeBehaviorWatcher hideWatcher = createOverviewHideWatcher(cta);
onView(withId(R.id.tab_list_view))
.inRoot(withDecorView(not(cta.getWindow().getDecorView())))
onView(allOf(withId(R.id.tab_list_view), withParent(withId(R.id.dialog_container_view))))
.perform(RecyclerViewActions.actionOnItemAtPosition(index, click()));
hideWatcher.waitForBehavior();
}
......@@ -169,18 +168,16 @@ public class TabUiTestHelper {
* Close the first tab in tab gri dialog.
* @param cta The current running activity.
*/
static void closeFirstTabInDialog(ChromeTabbedActivity cta) {
closeNthTabInDialog(cta, 0);
static void closeFirstTabInDialog() {
closeNthTabInDialog(0);
}
/**
* Close the Nth tab in tab gri dialog.
* @param cta The current running activity.
* @param index The index of the target tab to close.
*/
static void closeNthTabInDialog(ChromeTabbedActivity cta, int index) {
onView(withId(R.id.tab_list_view))
.inRoot(withDecorView(not(cta.getWindow().getDecorView())))
static void closeNthTabInDialog(int index) {
onView(allOf(withId(R.id.tab_list_view), withParent(withId(R.id.dialog_container_view))))
.perform(new ViewAction() {
@Override
public Matcher<View> getConstraints() {
......
......@@ -403,7 +403,7 @@ public class TabGridItemTouchHelperCallbackUnitTest {
mMockViewHolder1, ItemTouchHelper.ACTION_STATE_IDLE);
verify(mTabGridDialogHandler)
.updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.HIDE);
.updateUngroupBarStatus(TabGridDialogView.UngroupBarStatus.HIDE);
}
@Test
......@@ -418,7 +418,7 @@ public class TabGridItemTouchHelperCallbackUnitTest {
verify(mTabGroupModelFilter).moveTabOutOfGroup(TAB1_ID);
verify(mTabGridDialogHandler)
.updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.HIDE);
.updateUngroupBarStatus(TabGridDialogView.UngroupBarStatus.HIDE);
verify(mGridLayoutManager).removeView(mItemView1);
}
......@@ -437,7 +437,7 @@ public class TabGridItemTouchHelperCallbackUnitTest {
verify(mTabGroupModelFilter, never()).moveTabOutOfGroup(TAB1_ID);
verify(mTabGridDialogHandler)
.updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.HIDE);
.updateUngroupBarStatus(TabGridDialogView.UngroupBarStatus.HIDE);
verify(mGridLayoutManager, never()).removeView(mItemView1);
}
......@@ -456,7 +456,7 @@ public class TabGridItemTouchHelperCallbackUnitTest {
verify(mTabGroupModelFilter, never()).moveTabOutOfGroup(TAB1_ID);
verify(mTabGridDialogHandler)
.updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.HIDE);
.updateUngroupBarStatus(TabGridDialogView.UngroupBarStatus.HIDE);
verify(mGridLayoutManager, never()).removeView(mItemView1);
}
......@@ -647,14 +647,14 @@ public class TabGridItemTouchHelperCallbackUnitTest {
ItemTouchHelper.ACTION_STATE_DRAG, true);
verify(mTabGridDialogHandler)
.updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.HOVERED);
.updateUngroupBarStatus(TabGridDialogView.UngroupBarStatus.HOVERED);
// Simulate dragging card#3 down to the ungroup bar.
mItemTouchHelperCallback.onChildDraw(mCanvas, mRecyclerView, mDummyViewHolder1, 0, 2,
ItemTouchHelper.ACTION_STATE_DRAG, true);
verify(mTabGridDialogHandler)
.updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.HOVERED);
.updateUngroupBarStatus(TabGridDialogView.UngroupBarStatus.HOVERED);
}
@Test
......@@ -674,10 +674,10 @@ public class TabGridItemTouchHelperCallbackUnitTest {
ItemTouchHelper.ACTION_STATE_DRAG, true);
verify(mTabGridDialogHandler, times(2))
.updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.SHOW);
.updateUngroupBarStatus(TabGridDialogView.UngroupBarStatus.SHOW);
verify(mTabGridDialogHandler, never())
.updateUngroupBarStatus(TabGridDialogParent.UngroupBarStatus.HOVERED);
.updateUngroupBarStatus(TabGridDialogView.UngroupBarStatus.HOVERED);
}
@Test
......
......@@ -37,8 +37,8 @@ tab_management_test_java_sources = [
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/MessageCardViewBinderTest.java",
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/RecyclerViewMatcherUtils.java",
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridAccessibilityHelperTest.java",
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogParentTest.java",
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogTest.java",
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogViewTest.java",
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridIphTest.java",
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGridPanelViewBinderTest.java",
"//chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupPopupUiTest.java",
......
......@@ -9,8 +9,8 @@
-org.chromium.chrome.browser.shape_detection.ShapeDetectionTest.testTextDetection
# crbug/1036552
-org.chromium.chrome.browser.tasks.tab_management.TabGridDialogParentTest.testDialog_ZoomInFadeOut
-org.chromium.chrome.browser.tasks.tab_management.TabGridDialogParentTest.testDialog_ZoomInZoomOut
-org.chromium.chrome.browser.tasks.tab_management.TabGridDialogViewTest.testDialog_ZoomInFadeOut
-org.chromium.chrome.browser.tasks.tab_management.TabGridDialogViewTest.testDialog_ZoomInZoomOut
# vr tests do not apply to emulator
-org.chromium.chrome.browser.hardware_acceleration.ManifestHWATest.testAccelerationDisabled
......
......@@ -41,8 +41,8 @@
-org.chromium.chrome.browser.suggestions.tile.TileGroupTest.testDismissTileWithContextMenu
# crbug/1036552
-org.chromium.chrome.browser.tasks.tab_management.TabGridDialogParentTest.testDialog_ZoomInFadeOut
-org.chromium.chrome.browser.tasks.tab_management.TabGridDialogParentTest.testDialog_ZoomInZoomOut
-org.chromium.chrome.browser.tasks.tab_management.TabGridDialogViewTest.testDialog_ZoomInFadeOut
-org.chromium.chrome.browser.tasks.tab_management.TabGridDialogViewTest.testDialog_ZoomInZoomOut
# crbug/1036553
-org.chromium.chrome.browser.translate.TranslateCompactInfoBarTest.testTabMenuDismissedOnOrientationChange
......
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