Merge "Include IPv6 DNS servers in wifi details" into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-09-11 04:56:28 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 4 deletions

View File

@@ -431,9 +431,8 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
}
}
// Find IPv4 DNS addresses.
// Find all (IPv4 and IPv6) DNS addresses.
String dnsServers = mLinkProperties.getDnsServers().stream()
.filter(Inet4Address.class::isInstance)
.map(InetAddress::getHostAddress)
.collect(Collectors.joining("\n"));

View File

@@ -437,10 +437,14 @@ public class WifiDetailPreferenceControllerTest {
public void dnsServersPref_shouldHaveDetailTextSet() throws UnknownHostException {
mLinkProperties.addDnsServer(InetAddress.getByAddress(new byte[]{8,8,4,4}));
mLinkProperties.addDnsServer(InetAddress.getByAddress(new byte[]{8,8,8,8}));
mLinkProperties.addDnsServer(Constants.IPV6_DNS);
displayAndResume();
verify(mockDnsPref).setDetailText("8.8.4.4\n8.8.8.8");
verify(mockDnsPref).setDetailText(
"8.8.4.4\n" +
"8.8.8.8\n" +
Constants.IPV6_DNS.getHostAddress());
}
@Test
@@ -546,12 +550,14 @@ public class WifiDetailPreferenceControllerTest {
lp.addDnsServer(Constants.IPV6_DNS);
updateLinkProperties(lp);
inOrder.verify(mockDnsPref, never()).setVisible(true);
inOrder.verify(mockDnsPref).setDetailText(Constants.IPV6_DNS.getHostAddress());
inOrder.verify(mockDnsPref).setVisible(true);
lp.addDnsServer(Constants.IPV4_DNS1);
lp.addDnsServer(Constants.IPV4_DNS2);
updateLinkProperties(lp);
inOrder.verify(mockDnsPref).setDetailText(
Constants.IPV6_DNS.getHostAddress() + "\n" +
Constants.IPV4_DNS1.getHostAddress() + "\n" +
Constants.IPV4_DNS2.getHostAddress());
inOrder.verify(mockDnsPref).setVisible(true);