Commit 9a93f505 authored by spdonghao's avatar spdonghao Committed by Chromium LUCI CQ

Disable close tab option when there are no open tabs.

Bug: 1155761
Change-Id: I9c98e3c0066c98e9d9fe7fad43442c0615bda4be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576112Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Commit-Queue: Hao Dong <spdonghao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835085}
parent 126e61fd
......@@ -8,9 +8,11 @@ import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.Visibility.GONE;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.isEnabled;
import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
......@@ -167,6 +169,7 @@ public class StartSurfaceNoTabsTest {
.check(matches(withEffectiveVisibility(GONE)));
onView(withId(org.chromium.chrome.tab_ui.R.id.more_tabs))
.check(matches(withEffectiveVisibility(GONE)));
onView(withId(R.id.start_tab_switcher_button)).check(matches(not(isEnabled())));
}
@Test
......
......@@ -64,6 +64,7 @@ public class TabSwitcherButtonCoordinator {
public void setTabCountProvider(TabCountProvider tabCountProvider) {
mTabCountProvider = tabCountProvider;
updateButtonState();
mTabCountObserver = new TabCountObserver() {
@Override
public void onTabCountChanged(int tabCount, boolean isIncognito) {
......
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