Search in sources :

Example 1 with ShadowConnectivityManager

use of com.android.settings.testutils.shadow.ShadowConnectivityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MobileNetworkPreferenceControllerTest method wifiOnly_prefIsNotAvailable.

@Test
public void wifiOnly_prefIsNotAvailable() {
    ShadowUserManager userManager = extract(mContext.getSystemService(UserManager.class));
    userManager.setIsAdminUser(true);
    ShadowConnectivityManager connectivityManager = extract(mContext.getSystemService(ConnectivityManager.class));
    connectivityManager.setNetworkSupported(ConnectivityManager.TYPE_MOBILE, false);
    mController = new MobileNetworkPreferenceController(mContext);
    assertThat(mController.isAvailable()).isFalse();
}
Also used : ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) UserManager(android.os.UserManager) ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) ConnectivityManager(android.net.ConnectivityManager) ShadowConnectivityManager(com.android.settings.testutils.shadow.ShadowConnectivityManager) ShadowConnectivityManager(com.android.settings.testutils.shadow.ShadowConnectivityManager) Test(org.junit.Test)

Example 2 with ShadowConnectivityManager

use of com.android.settings.testutils.shadow.ShadowConnectivityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MobileNetworkPreferenceControllerTest method secondaryUser_prefIsNotAvailable.

@Test
public void secondaryUser_prefIsNotAvailable() {
    ShadowUserManager userManager = extract(mContext.getSystemService(UserManager.class));
    userManager.setIsAdminUser(false);
    ShadowConnectivityManager connectivityManager = extract(mContext.getSystemService(ConnectivityManager.class));
    connectivityManager.setNetworkSupported(ConnectivityManager.TYPE_MOBILE, true);
    mController = new MobileNetworkPreferenceController(mContext);
    assertThat(mController.isAvailable()).isFalse();
}
Also used : ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) UserManager(android.os.UserManager) ShadowUserManager(com.android.settings.testutils.shadow.ShadowUserManager) ConnectivityManager(android.net.ConnectivityManager) ShadowConnectivityManager(com.android.settings.testutils.shadow.ShadowConnectivityManager) ShadowConnectivityManager(com.android.settings.testutils.shadow.ShadowConnectivityManager) Test(org.junit.Test)

Example 3 with ShadowConnectivityManager

use of com.android.settings.testutils.shadow.ShadowConnectivityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BasebandVersionPreferenceControllerTest method getAvailability_wifiOnly_unavailable.

@Test
public void getAvailability_wifiOnly_unavailable() {
    final ShadowConnectivityManager connectivityManager = extract(mContext.getSystemService(ConnectivityManager.class));
    connectivityManager.setNetworkSupported(ConnectivityManager.TYPE_MOBILE, false);
    assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
}
Also used : ConnectivityManager(android.net.ConnectivityManager) ShadowConnectivityManager(com.android.settings.testutils.shadow.ShadowConnectivityManager) ShadowConnectivityManager(com.android.settings.testutils.shadow.ShadowConnectivityManager) Test(org.junit.Test)

Example 4 with ShadowConnectivityManager

use of com.android.settings.testutils.shadow.ShadowConnectivityManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BasebandVersionPreferenceControllerTest method getAvailability_hasMobile_available.

@Test
public void getAvailability_hasMobile_available() {
    final String text = "test";
    SystemProperties.set(BASEBAND_PROPERTY, text);
    ShadowConnectivityManager connectivityManager = extract(mContext.getSystemService(ConnectivityManager.class));
    connectivityManager.setNetworkSupported(ConnectivityManager.TYPE_MOBILE, true);
    assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
Also used : ConnectivityManager(android.net.ConnectivityManager) ShadowConnectivityManager(com.android.settings.testutils.shadow.ShadowConnectivityManager) ShadowConnectivityManager(com.android.settings.testutils.shadow.ShadowConnectivityManager) Test(org.junit.Test)

Aggregations

ConnectivityManager (android.net.ConnectivityManager)4 ShadowConnectivityManager (com.android.settings.testutils.shadow.ShadowConnectivityManager)4 Test (org.junit.Test)4 UserManager (android.os.UserManager)2 ShadowUserManager (com.android.settings.testutils.shadow.ShadowUserManager)2