Allow HostCache to handle network changes itself

HostCache can already expire all of its entries when the network changes
and return them only when entries from other networks are allowed. This
change makes HostResolverImpl notify HostCache on network change instead
of clearing it, and modifies the StaleHostResolver tests to simulate a
network change using NetworkChangeNotifier rather than directly
notifying HostCache so that the relevant codepath is tested. The
addition of net_java in deps is necessary to use NetworkChangeNotifier
on Android.

This change finishes implementation of the "allow_other_networks" option
in Cronet's "StaleDNS" experiment.

BUG=691078
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_cronet_tester

Review-Url: https://codereview.chromium.org/2692043002
Cr-Commit-Position: refs/heads/master@{#450096}
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index c078986f..dfd4752 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -2452,7 +2452,7 @@
   // Abandon all ProbeJobs.
   probe_weak_ptr_factory_.InvalidateWeakPtrs();
   if (cache_.get()) {
-    cache_->clear();
+    cache_->OnNetworkChange();
     cache_hit_callbacks_.clear();
   }
 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)