Commit c2e25ebb authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Fix flakiness in ChromeBrowserInitializerTest

Allow disk reads so the test running handleSynchronousStartup() does not
trigger strict mode violations.

Bug: 1131373
Change-Id: If3e0ccd0fa51c7f6a492bcf7793b40ee88e84d2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2441649Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812393}
parent 36155f5b
......@@ -11,7 +11,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.StrictModeContext;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
......@@ -31,11 +31,12 @@ public class ChromeBrowserInitializerTest {
@Test
@SmallTest
@DisabledTest(message = "https://crbug.com/1131373")
public void testSynchronousInitialization() throws Exception {
TestThreadUtils.runOnUiThreadBlocking(() -> {
Assert.assertFalse(mInstance.isFullBrowserInitialized());
mInstance.handleSynchronousStartup();
try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) {
mInstance.handleSynchronousStartup();
}
Assert.assertTrue(mInstance.isFullBrowserInitialized());
return true;
});
......@@ -73,7 +74,9 @@ public class ChromeBrowserInitializerTest {
TestThreadUtils.runOnUiThreadBlocking(() -> {
mInstance.runNowOrAfterFullBrowserStarted(done::release);
Assert.assertFalse("Should not run synchronously", done.tryAcquire());
mInstance.handleSynchronousStartup();
try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) {
mInstance.handleSynchronousStartup();
}
Assert.assertTrue(done.tryAcquire());
return true;
});
......
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