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 "chromeos/network/proxy/proxy_config_service_impl.h" | 5 #include "chromeos/network/proxy/proxy_config_service_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 void SetUserConfigInShill(base::DictionaryValue* pref_proxy_config_dict) { | 344 void SetUserConfigInShill(base::DictionaryValue* pref_proxy_config_dict) { |
345 std::string proxy_config; | 345 std::string proxy_config; |
346 if (pref_proxy_config_dict) | 346 if (pref_proxy_config_dict) |
347 base::JSONWriter::Write(*pref_proxy_config_dict, &proxy_config); | 347 base::JSONWriter::Write(*pref_proxy_config_dict, &proxy_config); |
348 | 348 |
349 NetworkStateHandler* network_state_handler = | 349 NetworkStateHandler* network_state_handler = |
350 NetworkHandler::Get()->network_state_handler(); | 350 NetworkHandler::Get()->network_state_handler(); |
351 const NetworkState* network = network_state_handler->DefaultNetwork(); | 351 const NetworkState* network = network_state_handler->DefaultNetwork(); |
352 ASSERT_TRUE(network); | 352 ASSERT_TRUE(network); |
353 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()-> | 353 DBusThreadManager::Get() |
354 SetServiceProperty(network->path(), | 354 ->GetShillServiceClient() |
355 shill::kProxyConfigProperty, | 355 ->GetTestInterface() |
356 base::StringValue(proxy_config)); | 356 ->SetServiceProperty(network->path(), shill::kProxyConfigProperty, |
| 357 base::Value(proxy_config)); |
357 } | 358 } |
358 | 359 |
359 // Synchronously gets the latest proxy config. | 360 // Synchronously gets the latest proxy config. |
360 void SyncGetLatestProxyConfig(net::ProxyConfig* config) { | 361 void SyncGetLatestProxyConfig(net::ProxyConfig* config) { |
361 *config = net::ProxyConfig(); | 362 *config = net::ProxyConfig(); |
362 // Let message loop process all messages. This will run | 363 // Let message loop process all messages. This will run |
363 // ChromeProxyConfigService::UpdateProxyConfig, which is posted on IO from | 364 // ChromeProxyConfigService::UpdateProxyConfig, which is posted on IO from |
364 // PrefProxyConfigTrackerImpl::OnProxyConfigChanged. | 365 // PrefProxyConfigTrackerImpl::OnProxyConfigChanged. |
365 base::RunLoop().RunUntilIdle(); | 366 base::RunLoop().RunUntilIdle(); |
366 net::ProxyConfigService::ConfigAvailability availability = | 367 net::ProxyConfigService::ConfigAvailability availability = |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 network_configs.release()); | 528 network_configs.release()); |
528 | 529 |
529 net::ProxyConfig actual_config; | 530 net::ProxyConfig actual_config; |
530 SyncGetLatestProxyConfig(&actual_config); | 531 SyncGetLatestProxyConfig(&actual_config); |
531 net::ProxyConfig expected_config = | 532 net::ProxyConfig expected_config = |
532 net::ProxyConfig::CreateFromCustomPacURL(GURL("http://domain.com/x")); | 533 net::ProxyConfig::CreateFromCustomPacURL(GURL("http://domain.com/x")); |
533 EXPECT_TRUE(expected_config.Equals(actual_config)); | 534 EXPECT_TRUE(expected_config.Equals(actual_config)); |
534 } | 535 } |
535 | 536 |
536 } // namespace chromeos | 537 } // namespace chromeos |
OLD | NEW |