Commit 915bc9a2 authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Fix flaky test ReturnToChromeTest#testInitialScrollIndex

Bug: 1023079
Change-Id: Iad81472ebfbdbd65d72391e1d9d38d23c2317a7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1907519Reviewed-by: default avatarYue Zhang <yuezhanggg@chromium.org>
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714318}
parent f10984c2
......@@ -306,6 +306,12 @@ public class TabUiTestHelper {
() -> rule.getActivity().getTabContentManager().getPendingReadbacksForTesting()));
}
public static void verifyAllTabsHaveThumbnail(TabModel tabModel) {
for (int i = 0; i < tabModel.getCount(); i++) {
checkThumbnailsExist(tabModel.getTabAt(i));
}
}
public static void checkThumbnailsExist(Tab tab) {
File etc1File = TabContentManager.getTabThumbnailFileEtc1(tab);
CriteriaHelper.pollInstrumentationThread(etc1File::exists,
......
......@@ -19,7 +19,6 @@ import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.FlakyTest;
import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
......@@ -110,10 +109,15 @@ public class ReturnToChromeTest {
@Test
@SmallTest
@Feature({"ReturnToChrome", "RenderTest"})
@FlakyTest(message = "crbug.com/1023079")
@CommandLineFlags.Add({BASE_PARAMS + "/" + TAB_SWITCHER_ON_RETURN_MS + "/0"})
public void testInitialScrollIndex() throws Exception {
TabUiTestHelper.prepareTabsWithThumbnail(mActivityTestRule, 10, 0, mUrl);
// Trigger thumbnail capturing for the last tab.
TabUiTestHelper.enterTabSwitcher(mActivityTestRule.getActivity());
TabUiTestHelper.verifyAllTabsHaveThumbnail(
mActivityTestRule.getActivity().getCurrentTabModel());
ApplicationTestUtils.finishActivity(mActivityTestRule.getActivity());
mActivityTestRule.startMainActivityFromLauncher();
......
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