Merge "Protect entry points to add an eSIM when admin restricted" into qt-r1-dev

This commit is contained in:
TreeHugger Robot
2019-07-31 22:39:22 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ import android.text.TextUtils;
import com.android.settings.network.telephony.MobileNetworkActivity;
import com.android.settings.widget.AddPreference;
import com.android.settingslib.RestrictedLockUtils;
import org.junit.After;
import org.junit.Before;
@@ -373,4 +374,12 @@ public class MobileNetworkSummaryControllerTest {
verify(mPreference, atLeastOnce()).setAddWidgetEnabled(captor.capture());
assertThat(captor.getValue()).isTrue();
}
@Test
public void onResume_disabledByAdmin_prefStaysDisabled() {
mPreference.setDisabledByAdmin(new RestrictedLockUtils.EnforcedAdmin());
mController.displayPreference(mPreferenceScreen);
mController.onResume();
verify(mPreference, never()).setEnabled(eq(true));
}
}