Split off Android portion of DnsConfigServicePosix
Some minor cleanups, eg skipped passing a callback into the Watcher
since that is unnecessary for the simpler Android-only Watcher, but
everything should all be functionally equivalent to previous. Exception
is a trivial bugfix to still read nameservers into the config after
setting `unhandled_options` for a VPN case. Only affects netlogs and UMA
and such since configs are not used when `unhandled_options` is set.
Also made the underlying call into android::NetworkLibrary mockable, so
things could be tested without relying on the actual Android API calls.
Added some basic tests using this (and replaced the one (mostly-broken)
android-specific test in DnsConfigServicePosixTest).
Bug: 1157492
Change-Id: Ia6ffbfa63c263f430c6f0928ff7489f0fa5e7bb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2629490
Reviewed-by: Dan McArdle <[email protected]>
Commit-Queue: Eric Orth <[email protected]>
Cr-Commit-Position: refs/heads/master@{#852025}
diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn
index ea7c29d2..482b2b9 100644
--- a/net/dns/BUILD.gn
+++ b/net/dns/BUILD.gn
@@ -107,7 +107,12 @@
]
}
- if (is_posix) {
+ if (is_android) {
+ sources += [
+ "dns_config_service_android.cc",
+ "dns_config_service_android.h",
+ ]
+ } else if (is_posix) {
sources += [
"dns_config_service_posix.cc",
"dns_config_service_posix.h",
@@ -418,7 +423,9 @@
sources += [ "dns_config_service_win_unittest.cc" ]
}
- if (is_posix) {
+ if (is_android) {
+ sources += [ "dns_config_service_android_unittest.cc" ]
+ } else if (is_posix) {
sources += [ "dns_config_service_posix_unittest.cc" ]
}