Commit 86a501ee authored by Yue Zhang's avatar Yue Zhang Committed by Commit Bot

Hide tab strip when restore completed and overview visible

Currently, we try to show tab strip when tab model restore completed.
However, when return-to-clank is enabled, we are not in tab page when
restore completed, and therefore the strip should not show. This CL
fixes this issue and adds a test.

Bug: 1030606
Change-Id: I01df83b15682b353eb4e5eabada97d457384969e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2000965
Commit-Queue: Yue Zhang <yuezhanggg@chromium.org>
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Auto-Submit: Yue Zhang <yuezhanggg@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731642}
parent de8d367a
......@@ -147,7 +147,9 @@ public class TabGroupUiMediator {
@Override
public void restoreCompleted() {
Tab currentTab = mTabModelSelector.getCurrentTab();
if (currentTab == null) return;
// Do not try to show tab strip when there is no current tab or we are not in tab
// page when restore completed.
if (currentTab == null || overviewModeBehavior.overviewVisible()) return;
resetTabStripWithRelatedTabsForId(currentTab.getId());
}
......
......@@ -503,6 +503,21 @@ public class TabGroupUiMediatorUnitTest {
mVisibilityControllerInOrder.verify(mVisibilityController).setBottomControlsVisible(true);
}
@Test
public void restoreCompleted_OverviewModeVisible() {
// Assume mTab2 is selected, and it has related tabs mTab2 and mTab3. Also, the overview
// mode is visible when restoring completed.
initAndAssertProperties(mTab2);
doReturn(POSITION2).when(mTabModel).index();
doReturn(mTab2).when(mTabModelSelector).getCurrentTab();
doReturn(true).when(mOverviewModeBehavior).overviewVisible();
// Simulate restore finished.
mTabModelObserverArgumentCaptor.getValue().restoreCompleted();
mVisibilityControllerInOrder.verify(mVisibilityController, never())
.setBottomControlsVisible(anyBoolean());
}
@Test
public void tabClosureUndone_UiVisible_NotShowingOverviewMode() {
// Assume mTab2 is selected, and it has related tabs mTab2 and mTab3.
......
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