Commit b47546c2 authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Signin][Android] Fix flaky test of dialog recreation

This CL fixes the flaky test testDialogIsDismissedWhenRecreated by
replacing the original Activity.recreate() with a blocking call to
ensure the execution is blocked till the activity is resumed.

Bug: 1054855
Change-Id: I841cbc6668dc0d8df3ccbc9c9005023baebdc07e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144026Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759564}
parent 907d2dd1
......@@ -17,10 +17,9 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.chrome.test.util.ApplicationTestUtils;
import org.chromium.ui.test.util.DummyUiActivity;
import org.chromium.ui.test.util.DummyUiActivityTestCase;
......@@ -42,7 +41,6 @@ public class ConfirmManagedSyncDataDialogIntegrationTest extends DummyUiActivity
@Test
@LargeTest
@DisabledTest(message = "Flaky crbug.com/1054855")
public void testDialogIsDismissedWhenRecreated() {
ConfirmManagedSyncDataDialog dialog =
ConfirmManagedSyncDataDialog.create(mListenerMock, TEST_DOMAIN);
......@@ -50,8 +48,7 @@ public class ConfirmManagedSyncDataDialogIntegrationTest extends DummyUiActivity
dialog.show(activity.getSupportFragmentManager(), null);
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
Assert.assertTrue("The dialog should be visible!", dialog.getDialog().isShowing());
TestThreadUtils.runOnUiThreadBlocking(activity::recreate);
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
ApplicationTestUtils.recreateActivity(activity);
Assert.assertNull("The dialog should be dismissed!", dialog.getDialog());
}
}
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