Merge "Add SSID to Network Details page for Passpoint"

This commit is contained in:
TreeHugger Robot
2019-03-28 22:12:33 +00:00
committed by Android (Google) Code Review
4 changed files with 72 additions and 0 deletions

View File

@@ -105,6 +105,7 @@ public class WifiDetailPreferenceControllerTest {
private static final int RSSI = -55;
private static final int TX_LINK_SPEED = 123;
private static final int RX_LINK_SPEED = 54;
private static final String SSID = "ssid";
private static final String MAC_ADDRESS = WifiInfo.DEFAULT_MAC_ADDRESS;
private static final String SECURITY = "None";
@@ -154,6 +155,8 @@ public class WifiDetailPreferenceControllerTest {
@Mock
private Preference mockSecurityPref;
@Mock
private Preference mockSsidPref;
@Mock
private Preference mockMacAddressPref;
@Mock
private Preference mockIpAddressPref;
@@ -245,6 +248,7 @@ public class WifiDetailPreferenceControllerTest {
when(mockAccessPoint.getConfig()).thenReturn(mockWifiConfig);
when(mockAccessPoint.getLevel()).thenReturn(LEVEL);
when(mockAccessPoint.getSecurityString(false)).thenReturn(SECURITY);
when(mockAccessPoint.getSsidStr()).thenReturn(SSID);
when(mockConnectivityManager.getNetworkInfo(any(Network.class)))
.thenReturn(mockNetworkInfo);
doNothing().when(mockConnectivityManager).registerNetworkCallback(
@@ -314,6 +318,8 @@ public class WifiDetailPreferenceControllerTest {
.thenReturn(mockFrequencyPref);
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_SECURITY_PREF))
.thenReturn(mockSecurityPref);
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_SSID_PREF))
.thenReturn(mockSsidPref);
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_MAC_ADDRESS_PREF))
.thenReturn(mockMacAddressPref);
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_IP_ADDRESS_PREF))
@@ -462,6 +468,50 @@ public class WifiDetailPreferenceControllerTest {
verify(mockRxLinkSpeedPref).setVisible(false);
}
@Test
public void ssidPref_shouldHaveDetailTextSet() {
when(mockAccessPoint.isPasspoint()).thenReturn(true);
when(mockAccessPoint.isOsuProvider()).thenReturn(false);
displayAndResume();
verify(mockSsidPref, times(1)).setSummary(SSID);
when(mockAccessPoint.isPasspoint()).thenReturn(false);
when(mockAccessPoint.isOsuProvider()).thenReturn(true);
displayAndResume();
verify(mockSsidPref, times(2)).setSummary(SSID);
}
@Test
public void ssidPref_shouldShowIfPasspointOrOsu() {
when(mockAccessPoint.isPasspoint()).thenReturn(true);
when(mockAccessPoint.isOsuProvider()).thenReturn(false);
displayAndResume();
verify(mockSsidPref, times(1)).setVisible(true);
when(mockAccessPoint.isPasspoint()).thenReturn(false);
when(mockAccessPoint.isOsuProvider()).thenReturn(true);
displayAndResume();
verify(mockSsidPref, times(2)).setVisible(true);
}
@Test
public void ssidPref_shouldNotShowIfNotPasspoint() {
when(mockAccessPoint.isPasspoint()).thenReturn(false);
when(mockAccessPoint.isOsuProvider()).thenReturn(false);
displayAndResume();
verify(mockSsidPref).setVisible(false);
}
@Test
public void macAddressPref_shouldHaveDetailTextSet() {
displayAndResume();