summaryrefslogtreecommitdiffstats
path: root/services/tests
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2013-10-31 11:59:46 +0900
committerLorenzo Colitti <lorenzo@google.com>2013-11-18 12:04:14 +0900
commit416740ad4d9132005a71dc0883334e852235a18a (patch)
tree4b71edee51111709fe1c1333b2edc4ed70cdcdcd /services/tests
parent4be55a0eac092d79d7462ac6921505ebb628f428 (diff)
downloadframeworks_base-416740ad4d9132005a71dc0883334e852235a18a.zip
frameworks_base-416740ad4d9132005a71dc0883334e852235a18a.tar.gz
frameworks_base-416740ad4d9132005a71dc0883334e852235a18a.tar.bz2
Pass DNS server info notifications to observers.
These are sent if the device receives IPv6 Router Advertisements with DNS server configuration options. Currently, nothing listens to them; in a future change we will use them as IPv6 DNS servers. Bug: 9180552 Change-Id: I05000c0cd3867a68ab390102e8470b6912a9d3aa
Diffstat (limited to 'services/tests')
-rw-r--r--services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
index 30d4eff..4385dcd 100644
--- a/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
@@ -172,6 +172,46 @@ public class NetworkManagementServiceTest extends AndroidTestCase {
sendMessage("666 Address added 2001:db8::1/64 wlan0 1 0");
// Invalid code.
+
+ /**
+ * DNS information broadcasts.
+ */
+ sendMessage("615 DnsInfo servers rmnet_usb0 3600 2001:db8::1");
+ expectSoon(observer).interfaceDnsServerInfo("rmnet_usb0", 3600,
+ new String[]{"2001:db8::1"});
+
+ sendMessage("615 DnsInfo servers wlan0 14400 2001:db8::1,2001:db8::2");
+ expectSoon(observer).interfaceDnsServerInfo("wlan0", 14400,
+ new String[]{"2001:db8::1", "2001:db8::2"});
+
+ // We don't check for negative lifetimes, only for parse errors.
+ sendMessage("615 DnsInfo servers wlan0 -3600 ::1");
+ expectSoon(observer).interfaceDnsServerInfo("wlan0", -3600,
+ new String[]{"::1"});
+
+ sendMessage("615 DnsInfo servers wlan0 SIXHUNDRED ::1");
+ // Non-numeric lifetime.
+
+ sendMessage("615 DnsInfo servers wlan0 2001:db8::1");
+ // Missing lifetime.
+
+ sendMessage("615 DnsInfo servers wlan0 3600");
+ // No servers.
+
+ sendMessage("615 DnsInfo servers 3600 wlan0 2001:db8::1,2001:db8::2");
+ // Non-numeric lifetime.
+
+ sendMessage("615 DnsInfo wlan0 7200 2001:db8::1,2001:db8::2");
+ // Invalid tokens.
+
+ sendMessage("666 DnsInfo servers wlan0 5400 2001:db8::1");
+ // Invalid code.
+
+ // No syntax checking on the addresses.
+ sendMessage("615 DnsInfo servers wlan0 600 ,::,,foo,::1,");
+ expectSoon(observer).interfaceDnsServerInfo("wlan0", 600,
+ new String[]{"", "::", "", "foo", "::1"});
+
// Make sure nothing else was called.
verifyNoMoreInteractions(observer);
}