From 39329c219d0787c0041e34947d17c0747e1aa06b Mon Sep 17 00:00:00 2001 From: Kasia Krejszeff Date: Fri, 13 Dec 2024 16:15:51 +0000 Subject: [PATCH] Ensure Private profile is present in tests in the FaceFingerprintUnlockControllerTest and re-enable ignored tests. Bug: 323652985 Flag: TEST_ONLY Test: atest FaceFingerprintUnlockControllerTest Change-Id: I0c923a95b8b7cf1320b68818e831dea5bb7510bf --- .../FaceFingerprintUnlockControllerTest.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/unit/src/com/android/settings/privatespace/FaceFingerprintUnlockControllerTest.java b/tests/unit/src/com/android/settings/privatespace/FaceFingerprintUnlockControllerTest.java index bdeede874fc..ba82e19a6e6 100644 --- a/tests/unit/src/com/android/settings/privatespace/FaceFingerprintUnlockControllerTest.java +++ b/tests/unit/src/com/android/settings/privatespace/FaceFingerprintUnlockControllerTest.java @@ -34,8 +34,8 @@ import com.android.settings.privatespace.onelock.FaceFingerprintUnlockController import com.android.settings.testutils.FakeFeatureFactory; import com.android.settingslib.core.lifecycle.Lifecycle; +import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -51,6 +51,7 @@ public class FaceFingerprintUnlockControllerTest { @Mock LockPatternUtils mLockPatternUtils; private Preference mPreference; + private PrivateSpaceMaintainer mPrivateSpaceMaintainer; private FaceFingerprintUnlockController mFaceFingerprintUnlockController; /** Required setup before a test. */ @@ -68,12 +69,26 @@ public class FaceFingerprintUnlockControllerTest { .thenReturn(mLockPatternUtils); doReturn(true).when(mLockPatternUtils).isSecure(anyInt()); + + mPrivateSpaceMaintainer = PrivateSpaceMaintainer.getInstance(mContext); + assertThat(mPrivateSpaceMaintainer.createPrivateSpace()).isTrue(); + assertThat(mPrivateSpaceMaintainer.doesPrivateSpaceExist()).isTrue(); + mFaceFingerprintUnlockController = new FaceFingerprintUnlockController(mContext, mLifecycle); } + @After + public void tearDown() { + // Ensure PSMaintainer is able to remove PS. + mSetFlagsRule.enableFlags( + android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE, + android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES); + assertThat(mPrivateSpaceMaintainer.deletePrivateSpace()) + .isEqualTo(PrivateSpaceMaintainer.ErrorDeletingPrivateSpace.DELETE_PS_ERROR_NONE); + } + /** Tests that the controller is always available. */ - @Ignore("b/323652985") @Test public void getAvailabilityStatus_whenFlagsEnabled_returnsAvailable() { mSetFlagsRule.enableFlags( @@ -134,7 +149,6 @@ public class FaceFingerprintUnlockControllerTest { } /** Tests that preference is enabled and summary is not same as device lock. */ - @Ignore("b/323652985") @Test public void getSummary_whenSeparateProfileLock() { doReturn(true).when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());