Commit 7770990a authored by Ben Joyce's avatar Ben Joyce Committed by Commit Bot

Batch profile tests.

reduces speed from 16438ms to 4656 ms

Bug: 989569
Change-Id: Ide7b215a03df82d724f5e3639038734c2c574857
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438779
Commit-Queue: benjamin joyce <bjoyce@chromium.org>
Reviewed-by: default avatarRohit Agarwal <roagarwal@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816336}
parent afdb1a93
...@@ -8,15 +8,18 @@ import androidx.test.filters.LargeTest; ...@@ -8,15 +8,18 @@ import androidx.test.filters.LargeTest;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabLaunchType;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule;
import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
...@@ -25,24 +28,29 @@ import org.chromium.content_public.browser.test.util.TestThreadUtils; ...@@ -25,24 +28,29 @@ import org.chromium.content_public.browser.test.util.TestThreadUtils;
* distinctly created. * distinctly created.
*/ */
@RunWith(ChromeJUnit4ClassRunner.class) @RunWith(ChromeJUnit4ClassRunner.class)
@Batch(Batch.PER_CLASS)
@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE})
public class ProfileTest { public class ProfileTest {
@ClassRule
public static final ChromeTabbedActivityTestRule sActivityTestRule =
new ChromeTabbedActivityTestRule();
@Rule @Rule
public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); public final BlankCTATabInitialStateRule mInitialStateRule =
new BlankCTATabInitialStateRule(sActivityTestRule, false);
public Profile mRegularProfile; public Profile mRegularProfile;
@Before @Before
public void setUp() { public void setUp() {
mActivityTestRule.startMainActivityOnBlankPage();
createRegularProfileOnUiThread(); createRegularProfileOnUiThread();
} }
private void createRegularProfileOnUiThread() { private void createRegularProfileOnUiThread() {
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
mActivityTestRule.getActivity().getTabCreator(false).createNewTab( sActivityTestRule.getActivity().getTabCreator(false).createNewTab(
new LoadUrlParams("about:blank"), TabLaunchType.FROM_CHROME_UI, null); new LoadUrlParams("about:blank"), TabLaunchType.FROM_CHROME_UI, null);
mRegularProfile = mActivityTestRule.getActivity() mRegularProfile = sActivityTestRule.getActivity()
.getTabModelSelector() .getTabModelSelector()
.getModel(false) .getModel(false)
.getProfile(); .getProfile();
......
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