Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_settings_unittest.cc

Issue 373153003: Bypass data reduction proxy when using VPN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/browser/data_reduction_proxy_settings_unittest.cc
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_settings_unittest.cc
index 28548827409f0d54e7503500d8d601accf29ebea..a8ac9f0d4f0e0568cae22c5cec3ec7a3a2461be5 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_settings_unittest.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_settings_unittest.cc
@@ -296,8 +296,39 @@ TEST_F(DataReductionProxySettingsTest, TestOnIPAddressChanged) {
true,
true,
false);
- // IP address change triggers a probe that succeed. Proxy is unrestricted.
- CheckProbeOnIPChange(kProbeURLWithBadResponse,
+ // IP address change triggers a probe that succeeds. Proxy is unrestricted.
+ CheckProbeOnIPChange(kProbeURLWithOKResponse,
+ kWarmupURLWithNoContentResponse,
+ "OK",
+ true,
+ false,
+ false);
+ // Simulate a VPN connection. The proxy should be disabled.
+ MockSettings* settings = static_cast<MockSettings*>(settings_.get());
+ settings->network_interfaces_.reset(new net::NetworkInterfaceList());
+ settings->network_interfaces_->push_back(
+ net::NetworkInterface("tun0", /* network interface name */
+ "tun0", /* network interface friendly name */
+ 0, /* interface index */
+ net::NetworkChangeNotifier::CONNECTION_WIFI,
+ net::IPAddressNumber(), /* IP address */
+ 0 /* network prefix */
+ ));
+ settings_->OnIPAddressChanged();
+ base::MessageLoop::current()->RunUntilIdle();
+ CheckProxyConfigs(false, false, false);
+
+ // Check that the proxy is re-enabled if a non-VPN connection is later used.
+ settings->network_interfaces_.reset(new net::NetworkInterfaceList());
+ settings->network_interfaces_->push_back(
+ net::NetworkInterface("eth0", /* network interface name */
+ "eth0", /* network interface friendly name */
+ 0, /* interface index */
+ net::NetworkChangeNotifier::CONNECTION_WIFI,
+ net::IPAddressNumber(),
+ 0 /* network prefix */
+ ));
+ CheckProbeOnIPChange(kProbeURLWithOKResponse,
kWarmupURLWithNoContentResponse,
"OK",
true,

Powered by Google App Engine
This is Rietveld 408576698