Merge "Replace hidden CM#isNetworkSupported() usage" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6f41bb5722
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Looper;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
@@ -63,8 +62,6 @@ public class MobileNetworkPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private UserManager mUserManager;
|
||||
@Mock
|
||||
private ConnectivityManager mConnectivityManager;
|
||||
|
||||
private PreferenceManager mPreferenceManager;
|
||||
private PreferenceScreen mScreen;
|
||||
@@ -82,7 +79,6 @@ public class MobileNetworkPreferenceControllerTest {
|
||||
when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
|
||||
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
|
||||
when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
|
||||
when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mConnectivityManager);
|
||||
if (Looper.myLooper() == null) {
|
||||
Looper.prepare();
|
||||
}
|
||||
@@ -98,8 +94,7 @@ public class MobileNetworkPreferenceControllerTest {
|
||||
@Test
|
||||
public void secondaryUser_prefIsNotAvailable() {
|
||||
when(mUserManager.isAdminUser()).thenReturn(false);
|
||||
when(mConnectivityManager.isNetworkSupported(ConnectivityManager.TYPE_MOBILE))
|
||||
.thenReturn(true);
|
||||
when(mTelephonyManager.isDataCapable()).thenReturn(true);
|
||||
|
||||
mController = new MobileNetworkPreferenceController(mContext);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
@@ -108,8 +103,7 @@ public class MobileNetworkPreferenceControllerTest {
|
||||
@Test
|
||||
public void wifiOnly_prefIsNotAvailable() {
|
||||
when(mUserManager.isAdminUser()).thenReturn(true);
|
||||
when(mConnectivityManager.isNetworkSupported(ConnectivityManager.TYPE_MOBILE))
|
||||
.thenReturn(false);
|
||||
when(mTelephonyManager.isDataCapable()).thenReturn(false);
|
||||
|
||||
mController = new MobileNetworkPreferenceController(mContext);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
|
Reference in New Issue
Block a user