Resolve race condition between @Before conditions

Bug: 159671700
Change-Id: I5c96c32c171b7b539ce0ea799cf45955c2bee670
This commit is contained in:
Samuel Fufa 2020-09-30 10:57:04 -07:00
parent 35879a3fdb
commit 9fa2d8812a
2 changed files with 5 additions and 1 deletions

View File

@ -279,6 +279,8 @@ public abstract class AbstractLauncherUiTest {
if (userManager != null) {
for (UserHandle userHandle : userManager.getUserProfiles()) {
if (!userHandle.isSystem()) {
Log.d(TestProtocol.WORK_PROFILE_REMOVED,
"removing user " + userHandle.getIdentifier());
mDevice.executeShellCommand("pm remove-user " + userHandle.getIdentifier());
}
}

View File

@ -55,7 +55,9 @@ public class WorkTabTest extends AbstractLauncherUiTest {
private static final int WORK_PAGE = AllAppsContainerView.AdapterHolder.WORK;
@Before
public void createWorkProfile() throws Exception {
@Override
public void setUp() throws Exception {
super.setUp();
String output =
mDevice.executeShellCommand(
"pm create-user --profileOf 0 --managed TestProfile");