From 9fa2d8812aeec1033b6912f3f373080276a644ae Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Wed, 30 Sep 2020 10:57:04 -0700 Subject: [PATCH] Resolve race condition between @Before conditions Bug: 159671700 Change-Id: I5c96c32c171b7b539ce0ea799cf45955c2bee670 --- .../src/com/android/launcher3/ui/AbstractLauncherUiTest.java | 2 ++ tests/src/com/android/launcher3/ui/WorkTabTest.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 5e42d9b988..e118481570 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -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()); } } diff --git a/tests/src/com/android/launcher3/ui/WorkTabTest.java b/tests/src/com/android/launcher3/ui/WorkTabTest.java index 488e763f94..8d594de926 100644 --- a/tests/src/com/android/launcher3/ui/WorkTabTest.java +++ b/tests/src/com/android/launcher3/ui/WorkTabTest.java @@ -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");