From c5b78e072f9871b4b1ec72fbf80d99670dc5419d Mon Sep 17 00:00:00 2001 From: kholoud mohamed Date: Mon, 27 Apr 2020 15:09:10 +0100 Subject: [PATCH] Fix broken tests in RedactionInterstitialTest correctly set the user as managed profile after the implementation for ShadowUserManager#isManagedProfile changed. Fixes: 154567856 Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.notification.RedactionInterstitialTest Change-Id: I14472913391c3986c5f27391023e396b7b64aad3 --- .../notification/RedactionInterstitialTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java b/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java index 081f76421f6..5c6da495235 100644 --- a/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java +++ b/tests/robotests/src/com/android/settings/notification/RedactionInterstitialTest.java @@ -11,6 +11,7 @@ import static org.robolectric.Robolectric.buildActivity; import android.content.ContentResolver; import android.content.Intent; +import android.content.pm.UserInfo; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; @@ -25,7 +26,6 @@ import com.android.settings.testutils.shadow.ShadowUtils; import org.junit.After; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -103,12 +103,13 @@ public class RedactionInterstitialTest { } @Test - @Ignore public void managedProfileNoRestrictionsTest() { setupSettings(1 /* show */, 1 /* showUnredacted */); final ShadowUserManager sum = Shadow.extract(RuntimeEnvironment.application.getSystemService(UserManager.class)); - sum.setManagedProfile(true); + sum.addProfile( + UserHandle.myUserId(), UserHandle.myUserId(), + "work-profile"/* profileName */, UserInfo.FLAG_MANAGED_PROFILE); setupActivity(); assertHideAllVisible(false); @@ -117,12 +118,13 @@ public class RedactionInterstitialTest { } @Test - @Ignore public void managedProfileUnredactedRestrictionTest() { setupSettings(1 /* show */, 1 /* showUnredacted */); final ShadowUserManager sum = Shadow.extract(RuntimeEnvironment.application.getSystemService(UserManager.class)); - sum.setManagedProfile(true); + sum.addProfile( + UserHandle.myUserId(), UserHandle.myUserId(), + "work-profile"/* profileName */, UserInfo.FLAG_MANAGED_PROFILE); ShadowRestrictedLockUtilsInternal.setKeyguardDisabledFeatures( KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS); setupActivity();