Commit 142bb9e4 authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

Deflake garbage collection test in TabSelectionEditorTest

The flaky test,
TabSelectionEditorTest.testTabSelectionEditorLayoutCanBeGarbageCollected
is reproduced locally, and noticed a longer timeout is
needed. This CL extends the time out by using the
CriteriaHelper.pollUiThread with
GarbageCollectionTestUtils.canBeGarbageCollected.

Change-Id: Id82312493e52601609ca4cbbd63bd68637f45373
Bug: 1075816
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2241345
Commit-Queue: Mei Liang <meiliang@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777526}
parent 26426786
...@@ -10,7 +10,6 @@ import android.support.test.filters.MediumTest; ...@@ -10,7 +10,6 @@ import android.support.test.filters.MediumTest;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.junit.After; import org.junit.After;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
...@@ -22,7 +21,6 @@ import org.chromium.base.GarbageCollectionTestUtils; ...@@ -22,7 +21,6 @@ import org.chromium.base.GarbageCollectionTestUtils;
import org.chromium.base.SysUtils; import org.chromium.base.SysUtils;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.ChromeTabbedActivity;
...@@ -466,7 +464,6 @@ public class TabSelectionEditorTest { ...@@ -466,7 +464,6 @@ public class TabSelectionEditorTest {
@Test @Test
@MediumTest @MediumTest
@DisableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID}) @DisableFeatures({ChromeFeatureList.TAB_GROUPS_ANDROID})
@DisabledTest(message = "crbug.com/1075816")
public void testTabSelectionEditorLayoutCanBeGarbageCollected() { public void testTabSelectionEditorLayoutCanBeGarbageCollected() {
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
mTabSelectionEditorCoordinator.destroy(); mTabSelectionEditorCoordinator.destroy();
...@@ -476,7 +473,9 @@ public class TabSelectionEditorTest { ...@@ -476,7 +473,9 @@ public class TabSelectionEditorTest {
}); });
InstrumentationRegistry.getInstrumentation().waitForIdleSync(); InstrumentationRegistry.getInstrumentation().waitForIdleSync();
Assert.assertTrue(GarbageCollectionTestUtils.canBeGarbageCollected(mRef));
// A longer timeout is needed. Achieve that by using the CriteriaHelper.pollUiThread.
CriteriaHelper.pollUiThread(() -> GarbageCollectionTestUtils.canBeGarbageCollected(mRef));
} }
private List<Tab> getTabsInCurrentTabModel() { private List<Tab> getTabsInCurrentTabModel() {
......
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