Merge "[Provider Model] Show carrier network to internet preference" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-06-23 10:11:33 +00:00
committed by Android (Google) Code Review
2 changed files with 27 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ import android.content.Context;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import androidx.lifecycle.Lifecycle;
@@ -194,4 +195,17 @@ public class InternetUpdaterTest {
assertThat(mInternetUpdater.getInternetType()).isEqualTo(INTERNET_ETHERNET);
}
@Test
public void updateInternetType_carrierWifiConnected_getInternetCellular() {
final WifiInfo wifiInfo = mock(WifiInfo.class);
doReturn(wifiInfo).when(mWifiManager).getConnectionInfo();
doReturn(true).when(wifiInfo).isCarrierMerged();
mInternetUpdater.mInternetAvailable = true;
mInternetUpdater.mTransport = TRANSPORT_WIFI;
mInternetUpdater.updateInternetType();
assertThat(mInternetUpdater.getInternetType()).isEqualTo(INTERNET_CELLULAR);
}
}