OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/md5.h" | 8 #include "base/md5.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 false); | 305 false); |
306 // IP address change triggers a probe that succeeds. Proxy is unrestricted. | 306 // IP address change triggers a probe that succeeds. Proxy is unrestricted. |
307 CheckProbeOnIPChange(kProbeURLWithOKResponse, | 307 CheckProbeOnIPChange(kProbeURLWithOKResponse, |
308 "OK", | 308 "OK", |
309 true, | 309 true, |
310 false, | 310 false, |
311 false); | 311 false); |
312 // Simulate a VPN connection. The proxy should be disabled. | 312 // Simulate a VPN connection. The proxy should be disabled. |
313 MockSettings* settings = static_cast<MockSettings*>(settings_.get()); | 313 MockSettings* settings = static_cast<MockSettings*>(settings_.get()); |
314 settings->network_interfaces_.reset(new net::NetworkInterfaceList()); | 314 settings->network_interfaces_.reset(new net::NetworkInterfaceList()); |
315 settings->network_interfaces_->push_back( | 315 settings->network_interfaces_->push_back(net::NetworkInterface( |
316 net::NetworkInterface("tun0", /* network interface name */ | 316 "tun0", /* network interface name */ |
317 "tun0", /* network interface friendly name */ | 317 "tun0", /* network interface friendly name */ |
318 0, /* interface index */ | 318 0, /* interface index */ |
319 net::NetworkChangeNotifier::CONNECTION_WIFI, | 319 net::NetworkChangeNotifier::CONNECTION_WIFI, |
320 net::IPAddressNumber(), /* IP address */ | 320 net::IPAddressNumber(), /* IP address */ |
321 0 /* network prefix */ | 321 0, /* network prefix */ |
322 )); | 322 net::IP_ADDRESS_ATTRIBUTE_NONE /* ip address attribute */ |
| 323 )); |
323 settings_->OnIPAddressChanged(); | 324 settings_->OnIPAddressChanged(); |
324 base::MessageLoop::current()->RunUntilIdle(); | 325 base::MessageLoop::current()->RunUntilIdle(); |
325 CheckProxyConfigs(false, false, false); | 326 CheckProxyConfigs(false, false, false); |
326 | 327 |
327 // Check that the proxy is re-enabled if a non-VPN connection is later used. | 328 // Check that the proxy is re-enabled if a non-VPN connection is later used. |
328 settings->network_interfaces_.reset(new net::NetworkInterfaceList()); | 329 settings->network_interfaces_.reset(new net::NetworkInterfaceList()); |
329 settings->network_interfaces_->push_back( | 330 settings->network_interfaces_->push_back(net::NetworkInterface( |
330 net::NetworkInterface("eth0", /* network interface name */ | 331 "eth0", /* network interface name */ |
331 "eth0", /* network interface friendly name */ | 332 "eth0", /* network interface friendly name */ |
332 0, /* interface index */ | 333 0, /* interface index */ |
333 net::NetworkChangeNotifier::CONNECTION_WIFI, | 334 net::NetworkChangeNotifier::CONNECTION_WIFI, |
334 net::IPAddressNumber(), | 335 net::IPAddressNumber(), |
335 0 /* network prefix */ | 336 0, /* network prefix */ |
336 )); | 337 net::IP_ADDRESS_ATTRIBUTE_NONE /* ip address attribute */ |
| 338 )); |
337 CheckProbeOnIPChange(kProbeURLWithOKResponse, | 339 CheckProbeOnIPChange(kProbeURLWithOKResponse, |
338 "OK", | 340 "OK", |
339 true, | 341 true, |
340 false, | 342 false, |
341 false); | 343 false); |
342 } | 344 } |
343 | 345 |
344 TEST_F(DataReductionProxySettingsTest, TestOnProxyEnabledPrefChange) { | 346 TEST_F(DataReductionProxySettingsTest, TestOnProxyEnabledPrefChange) { |
345 settings_->InitPrefMembers(); | 347 settings_->InitPrefMembers(); |
346 base::MessageLoopForUI loop; | 348 base::MessageLoopForUI loop; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 request_context.get()); | 419 request_context.get()); |
418 settings_->SetOnDataReductionEnabledCallback( | 420 settings_->SetOnDataReductionEnabledCallback( |
419 base::Bind(&DataReductionProxySettingsTestBase:: | 421 base::Bind(&DataReductionProxySettingsTestBase:: |
420 RegisterSyntheticFieldTrialCallback, | 422 RegisterSyntheticFieldTrialCallback, |
421 base::Unretained(this))); | 423 base::Unretained(this))); |
422 | 424 |
423 base::MessageLoop::current()->RunUntilIdle(); | 425 base::MessageLoop::current()->RunUntilIdle(); |
424 } | 426 } |
425 | 427 |
426 } // namespace data_reduction_proxy | 428 } // namespace data_reduction_proxy |
OLD | NEW |