Show policy transparency dialog for Wi-Fi network restrictions am: 28be567a83
am: cac69880ae
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24156648 Change-Id: I8c69cfc85156917c0223817fe4409f9b6357f05c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -18,6 +18,10 @@ package com.android.settings.wifi;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -60,7 +64,7 @@ public class LongPressWifiEntryPreferenceTest {
|
||||
when(mWifiEntry.canDisconnect()).thenReturn(false);
|
||||
when(mWifiEntry.isSaved()).thenReturn(false);
|
||||
|
||||
mPreference = new LongPressWifiEntryPreference(mContext, mWifiEntry, mFragment);
|
||||
mPreference = spy(new LongPressWifiEntryPreference(mContext, mWifiEntry, mFragment));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -106,4 +110,23 @@ public class LongPressWifiEntryPreferenceTest {
|
||||
|
||||
assertThat(mPreference.shouldEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkRestrictionAndSetDisabled_hasAdminRestrictions_doSetDisabledByAdmin() {
|
||||
when(mContext.getUser()).thenReturn(null);
|
||||
when(mWifiEntry.hasAdminRestrictions()).thenReturn(true);
|
||||
|
||||
mPreference.checkRestrictionAndSetDisabled();
|
||||
|
||||
verify(mPreference).setDisabledByAdmin(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkRestrictionAndSetDisabled_noAdminRestrictions_doNotSetDisabledByAdmin() {
|
||||
when(mWifiEntry.hasAdminRestrictions()).thenReturn(false);
|
||||
|
||||
mPreference.checkRestrictionAndSetDisabled();
|
||||
|
||||
verify(mPreference, never()).setDisabledByAdmin(any());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user