| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/proxy_config_service_impl.h" | 5 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 if (pref_proxy_config_dict) | 297 if (pref_proxy_config_dict) |
| 298 base::JSONWriter::Write(pref_proxy_config_dict, &proxy_config); | 298 base::JSONWriter::Write(pref_proxy_config_dict, &proxy_config); |
| 299 | 299 |
| 300 NetworkStateHandler* network_state_handler = | 300 NetworkStateHandler* network_state_handler = |
| 301 NetworkHandler::Get()->network_state_handler(); | 301 NetworkHandler::Get()->network_state_handler(); |
| 302 const NetworkState* network = network_state_handler->DefaultNetwork(); | 302 const NetworkState* network = network_state_handler->DefaultNetwork(); |
| 303 ASSERT_TRUE(network); | 303 ASSERT_TRUE(network); |
| 304 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()-> | 304 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()-> |
| 305 SetServiceProperty(network->path(), | 305 SetServiceProperty(network->path(), |
| 306 shill::kProxyConfigProperty, | 306 shill::kProxyConfigProperty, |
| 307 StringValue(proxy_config)); | 307 base::StringValue(proxy_config)); |
| 308 } | 308 } |
| 309 | 309 |
| 310 // Synchronously gets the latest proxy config. | 310 // Synchronously gets the latest proxy config. |
| 311 void SyncGetLatestProxyConfig(net::ProxyConfig* config) { | 311 void SyncGetLatestProxyConfig(net::ProxyConfig* config) { |
| 312 *config = net::ProxyConfig(); | 312 *config = net::ProxyConfig(); |
| 313 // Let message loop process all messages. This will run | 313 // Let message loop process all messages. This will run |
| 314 // ChromeProxyConfigService::UpdateProxyConfig, which is posted on IO from | 314 // ChromeProxyConfigService::UpdateProxyConfig, which is posted on IO from |
| 315 // PrefProxyConfigTrackerImpl::OnProxyConfigChanged. | 315 // PrefProxyConfigTrackerImpl::OnProxyConfigChanged. |
| 316 loop_.RunUntilIdle(); | 316 loop_.RunUntilIdle(); |
| 317 net::ProxyConfigService::ConfigAvailability availability = | 317 net::ProxyConfigService::ConfigAvailability availability = |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 pref_service_.RemoveRecommendedPref(prefs::kProxy); | 444 pref_service_.RemoveRecommendedPref(prefs::kProxy); |
| 445 SyncGetLatestProxyConfig(&actual_config); | 445 SyncGetLatestProxyConfig(&actual_config); |
| 446 EXPECT_EQ(network_params.auto_detect, actual_config.auto_detect()); | 446 EXPECT_EQ(network_params.auto_detect, actual_config.auto_detect()); |
| 447 EXPECT_EQ(network_params.pac_url, actual_config.pac_url()); | 447 EXPECT_EQ(network_params.pac_url, actual_config.pac_url()); |
| 448 EXPECT_TRUE(network_params.proxy_rules.Matches( | 448 EXPECT_TRUE(network_params.proxy_rules.Matches( |
| 449 actual_config.proxy_rules())); | 449 actual_config.proxy_rules())); |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 | 452 |
| 453 } // namespace chromeos | 453 } // namespace chromeos |
| OLD | NEW |