Commit 8f646f66 authored by Natalie Chouinard's avatar Natalie Chouinard Committed by Commit Bot

Revert "Add tests for undo closure in stack tab switcher"

This reverts commit e3d5c44e.

Reason for revert: Flaky failures on multiple bots
https://test-results.appspot.com/dashboards/flakiness_dashboard.html#testType=chrome_public_test_apk&tests=org.chromium.chrome.browser.TabsTest%23testUndo

Original change's description:
> Add tests for undo closure in stack tab switcher
> 
> Bug: 1064445
> Change-Id: I31bf5c42e013868282d1d220d7d871f411331494
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2150060
> Reviewed-by: Yusuf Ozuysal <yusufo@chromium.org>
> Reviewed-by: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
> Reviewed-by: Mei Liang <meiliang@chromium.org>
> Commit-Queue: Yue Zhang <yuezhanggg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#761720}

TBR=yusufo@chromium.org,wychen@chromium.org,meiliang@chromium.org,yuezhanggg@chromium.org

Change-Id: I447c525cdf6da5c69e200f775804fde888e67f9f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1064445
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2163386Reviewed-by: default avatarNatalie Chouinard <chouinard@chromium.org>
Commit-Queue: Natalie Chouinard <chouinard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761971}
parent bd438423
...@@ -6,14 +6,9 @@ package org.chromium.chrome.browser; ...@@ -6,14 +6,9 @@ package org.chromium.chrome.browser;
import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
import static android.support.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.allOf;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE; import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE;
import static org.chromium.chrome.test.util.ViewUtils.onViewWaiting;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.graphics.Point; import android.graphics.Point;
...@@ -999,7 +994,7 @@ public class TabsTest { ...@@ -999,7 +994,7 @@ public class TabsTest {
final int[] count = new int[1]; final int[] count = new int[1];
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
Stack stack = getStack(layoutManager, isIncognito); Stack stack = getStack(layoutManager, isIncognito);
count[0] = stack.getCount(); count[0] = stack.getTabs().length;
}); });
return count[0]; return count[0];
} }
...@@ -1863,95 +1858,6 @@ public class TabsTest { ...@@ -1863,95 +1858,6 @@ public class TabsTest {
assertFileExists(incognitoTabFile, false); assertFileExists(incognitoTabFile, false);
} }
@Test
@MediumTest
@Feature({"Android-TabSwitcher"})
public void testUndoNormalTabClosure() {
ChromeTabbedActivity cta = mActivityTestRule.getActivity();
TabModel normalTabModel = cta.getTabModelSelector().getModel(false);
for (int i = 0; i < 3; i++) {
ChromeTabUtils.newTabFromMenu(InstrumentationRegistry.getInstrumentation(), cta);
}
showOverviewAndWaitForAnimation();
CriteriaHelper.pollUiThread(Criteria.equals(4, () -> getLayoutTabInStackCount(false)));
Assert.assertEquals(4, normalTabModel.getCount());
// Close two normal tabs.
swipeToCloseNTabs(2, false, false, SWIPE_TO_LEFT_DIRECTION);
CriteriaHelper.pollUiThread(Criteria.equals(2, () -> getLayoutTabInStackCount(false)));
Assert.assertEquals(2, normalTabModel.getCount());
// Click the undo button on snackbar twice to undo two closures.
verifyUndoBarShowingAndClickUndo();
CriteriaHelper.pollUiThread(Criteria.equals(3, () -> getLayoutTabInStackCount(false)));
Assert.assertEquals(3, normalTabModel.getCount());
verifyUndoBarShowingAndClickUndo();
CriteriaHelper.pollUiThread(Criteria.equals(4, () -> getLayoutTabInStackCount(false)));
Assert.assertEquals(4, normalTabModel.getCount());
}
@Test
@MediumTest
@Feature({"Android-TabSwitcher"})
public void testUndoIncognitoTabClosure() {
ChromeTabbedActivity cta = mActivityTestRule.getActivity();
TabModel incognitoTabModel = cta.getTabModelSelector().getModel(true);
for (int i = 0; i < 4; i++) {
mActivityTestRule.newIncognitoTabFromMenu();
}
showOverviewAndWaitForAnimation();
CriteriaHelper.pollUiThread(Criteria.equals(4, () -> getLayoutTabInStackCount(true)));
Assert.assertEquals(4, incognitoTabModel.getCount());
// Close one incognito tab.
swipeToCloseNTabs(1, false, true, SWIPE_TO_LEFT_DIRECTION);
CriteriaHelper.pollUiThread(Criteria.equals(3, () -> getLayoutTabInStackCount(true)));
Assert.assertEquals(3, incognitoTabModel.getCount());
// The undo snackbar should never show.
onView(withId(R.id.snackbar_button)).check(doesNotExist());
Assert.assertFalse(cta.getSnackbarManager().isShowing());
}
@Test
@MediumTest
@Feature({"Android-TabSwitcher"})
// This test fails on API 23 emulators because the snack bar animation is not playing properly.
public void testUndoAllTabsClosure() throws InterruptedException {
ChromeTabbedActivity cta = mActivityTestRule.getActivity();
TabModel normalTabModel = cta.getTabModelSelector().getModel(false);
TabModel incognitoTabModel = cta.getTabModelSelector().getModel(true);
for (int i = 0; i < 2; i++) {
ChromeTabUtils.newTabFromMenu(InstrumentationRegistry.getInstrumentation(), cta);
}
for (int i = 0; i < 2; i++) {
mActivityTestRule.newIncognitoTabFromMenu();
}
showOverviewAndWaitForAnimation();
CriteriaHelper.pollUiThread(Criteria.equals(3, () -> getLayoutTabInStackCount(false)));
CriteriaHelper.pollUiThread(Criteria.equals(2, () -> getLayoutTabInStackCount(true)));
Assert.assertEquals(3, normalTabModel.getCount());
Assert.assertEquals(2, incognitoTabModel.getCount());
// Close all tabs through menu option.
MenuUtils.invokeCustomMenuActionSync(
InstrumentationRegistry.getInstrumentation(), cta, R.id.close_all_tabs_menu_id);
CriteriaHelper.pollUiThread(Criteria.equals(0, () -> getLayoutTabInStackCount(false)));
CriteriaHelper.pollUiThread(Criteria.equals(0, () -> getLayoutTabInStackCount(true)));
Assert.assertEquals(0, normalTabModel.getCount());
Assert.assertEquals(0, incognitoTabModel.getCount());
// Click the undo button on snackbar and should only undo closure of normal tabs.
verifyUndoBarShowingAndClickUndo();
CriteriaHelper.pollUiThread(Criteria.equals(3, () -> getLayoutTabInStackCount(false)));
CriteriaHelper.pollUiThread(Criteria.equals(0, () -> getLayoutTabInStackCount(true)));
Assert.assertEquals(3, normalTabModel.getCount());
Assert.assertEquals(0, incognitoTabModel.getCount());
}
/**
* Verify that the snack bar is showing and click on the snack bar button. Right now it is only
* used for undoing a tab closure.
*/
private void verifyUndoBarShowingAndClickUndo() {
onViewWaiting(allOf(withId(R.id.snackbar), isCompletelyDisplayed()));
onView(withId(R.id.snackbar_button)).perform(click());
}
/** /**
* Generate a URL that shows a web page with a solid color. This makes visual debugging easier. * Generate a URL that shows a web page with a solid color. This makes visual debugging easier.
* @param htmlColor The HTML/CSS color the page should display. * @param htmlColor The HTML/CSS color the page should display.
......
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