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
This commit is contained in:
Kasia Krejszeff
2024-12-13 16:15:51 +00:00
parent 1d0c7054b4
commit 39329c219d

View File

@@ -34,8 +34,8 @@ import com.android.settings.privatespace.onelock.FaceFingerprintUnlockController
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
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;
@@ -51,6 +51,7 @@ public class FaceFingerprintUnlockControllerTest {
@Mock LockPatternUtils mLockPatternUtils; @Mock LockPatternUtils mLockPatternUtils;
private Preference mPreference; private Preference mPreference;
private PrivateSpaceMaintainer mPrivateSpaceMaintainer;
private FaceFingerprintUnlockController mFaceFingerprintUnlockController; private FaceFingerprintUnlockController mFaceFingerprintUnlockController;
/** Required setup before a test. */ /** Required setup before a test. */
@@ -68,12 +69,26 @@ public class FaceFingerprintUnlockControllerTest {
.thenReturn(mLockPatternUtils); .thenReturn(mLockPatternUtils);
doReturn(true).when(mLockPatternUtils).isSecure(anyInt()); doReturn(true).when(mLockPatternUtils).isSecure(anyInt());
mPrivateSpaceMaintainer = PrivateSpaceMaintainer.getInstance(mContext);
assertThat(mPrivateSpaceMaintainer.createPrivateSpace()).isTrue();
assertThat(mPrivateSpaceMaintainer.doesPrivateSpaceExist()).isTrue();
mFaceFingerprintUnlockController = mFaceFingerprintUnlockController =
new FaceFingerprintUnlockController(mContext, mLifecycle); 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. */ /** Tests that the controller is always available. */
@Ignore("b/323652985")
@Test @Test
public void getAvailabilityStatus_whenFlagsEnabled_returnsAvailable() { public void getAvailabilityStatus_whenFlagsEnabled_returnsAvailable() {
mSetFlagsRule.enableFlags( mSetFlagsRule.enableFlags(
@@ -134,7 +149,6 @@ public class FaceFingerprintUnlockControllerTest {
} }
/** Tests that preference is enabled and summary is not same as device lock. */ /** Tests that preference is enabled and summary is not same as device lock. */
@Ignore("b/323652985")
@Test @Test
public void getSummary_whenSeparateProfileLock() { public void getSummary_whenSeparateProfileLock() {
doReturn(true).when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt()); doReturn(true).when(mLockPatternUtils).isSeparateProfileChallengeEnabled(anyInt());