| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/chromeos/ui_proxy_config.h" | 22 #include "chrome/browser/chromeos/ui_proxy_config.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "chromeos/dbus/dbus_thread_manager.h" | 24 #include "chromeos/dbus/dbus_thread_manager.h" |
| 25 #include "chromeos/dbus/shill_profile_client.h" | 25 #include "chromeos/dbus/shill_profile_client.h" |
| 26 #include "chromeos/dbus/shill_service_client.h" | 26 #include "chromeos/dbus/shill_service_client.h" |
| 27 #include "chromeos/network/network_handler.h" | 27 #include "chromeos/network/network_handler.h" |
| 28 #include "chromeos/network/network_profile_handler.h" | 28 #include "chromeos/network/network_profile_handler.h" |
| 29 #include "chromeos/network/network_state.h" | 29 #include "chromeos/network/network_state.h" |
| 30 #include "chromeos/network/network_state_handler.h" | 30 #include "chromeos/network/network_state_handler.h" |
| 31 #include "chromeos/network/onc/onc_utils.h" | 31 #include "chromeos/network/onc/onc_utils.h" |
| 32 #include "components/onc/onc_pref_names.h" |
| 32 #include "components/pref_registry/testing_pref_service_syncable.h" | 33 #include "components/pref_registry/testing_pref_service_syncable.h" |
| 33 #include "components/prefs/testing_pref_service.h" | 34 #include "components/prefs/testing_pref_service.h" |
| 34 #include "components/proxy_config/proxy_config_pref_names.h" | 35 #include "components/proxy_config/proxy_config_pref_names.h" |
| 35 #include "content/public/test/test_browser_thread.h" | 36 #include "content/public/test/test_browser_thread.h" |
| 36 #include "net/proxy/proxy_config.h" | 37 #include "net/proxy/proxy_config.h" |
| 37 #include "net/proxy/proxy_config_service_common_unittest.h" | 38 #include "net/proxy/proxy_config_service_common_unittest.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "third_party/cros_system_api/dbus/service_constants.h" | 40 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 40 | 41 |
| 41 using content::BrowserThread; | 42 using content::BrowserThread; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 protected: | 235 protected: |
| 235 ProxyConfigServiceImplTest() | 236 ProxyConfigServiceImplTest() |
| 236 : ui_thread_(BrowserThread::UI, &loop_), | 237 : ui_thread_(BrowserThread::UI, &loop_), |
| 237 io_thread_(BrowserThread::IO, &loop_) {} | 238 io_thread_(BrowserThread::IO, &loop_) {} |
| 238 | 239 |
| 239 void SetUp() override { | 240 void SetUp() override { |
| 240 DBusThreadManager::Initialize(); | 241 DBusThreadManager::Initialize(); |
| 241 NetworkHandler::Initialize(); | 242 NetworkHandler::Initialize(); |
| 242 | 243 |
| 243 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service_.registry()); | 244 PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service_.registry()); |
| 244 chromeos::proxy_config::RegisterPrefs(pref_service_.registry()); | 245 ::onc::RegisterPrefs(pref_service_.registry()); |
| 245 PrefProxyConfigTrackerImpl::RegisterProfilePrefs(profile_prefs_.registry()); | 246 PrefProxyConfigTrackerImpl::RegisterProfilePrefs(profile_prefs_.registry()); |
| 246 chromeos::proxy_config::RegisterProfilePrefs(profile_prefs_.registry()); | 247 ::onc::RegisterProfilePrefs(profile_prefs_.registry()); |
| 247 } | 248 } |
| 248 | 249 |
| 249 void SetUpProxyConfigService(PrefService* profile_prefs) { | 250 void SetUpProxyConfigService(PrefService* profile_prefs) { |
| 250 config_service_impl_.reset( | 251 config_service_impl_.reset( |
| 251 new ProxyConfigServiceImpl(profile_prefs, &pref_service_)); | 252 new ProxyConfigServiceImpl(profile_prefs, &pref_service_)); |
| 252 proxy_config_service_ = | 253 proxy_config_service_ = |
| 253 config_service_impl_->CreateTrackingProxyConfigService( | 254 config_service_impl_->CreateTrackingProxyConfigService( |
| 254 std::unique_ptr<net::ProxyConfigService>()); | 255 std::unique_ptr<net::ProxyConfigService>()); |
| 255 | 256 |
| 256 // CreateTrackingProxyConfigService triggers update of initial prefs proxy | 257 // CreateTrackingProxyConfigService triggers update of initial prefs proxy |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 TEST_F(ProxyConfigServiceImplTest, SharedEthernetAndUserPolicy) { | 510 TEST_F(ProxyConfigServiceImplTest, SharedEthernetAndUserPolicy) { |
| 510 SetUpSharedEthernet(); | 511 SetUpSharedEthernet(); |
| 511 SetUpProxyConfigService(&profile_prefs_); | 512 SetUpProxyConfigService(&profile_prefs_); |
| 512 | 513 |
| 513 std::unique_ptr<base::DictionaryValue> ethernet_policy( | 514 std::unique_ptr<base::DictionaryValue> ethernet_policy( |
| 514 chromeos::onc::ReadDictionaryFromJson(kEthernetPolicy)); | 515 chromeos::onc::ReadDictionaryFromJson(kEthernetPolicy)); |
| 515 | 516 |
| 516 std::unique_ptr<base::ListValue> network_configs(new base::ListValue); | 517 std::unique_ptr<base::ListValue> network_configs(new base::ListValue); |
| 517 network_configs->Append(std::move(ethernet_policy)); | 518 network_configs->Append(std::move(ethernet_policy)); |
| 518 | 519 |
| 519 profile_prefs_.SetUserPref(prefs::kUseSharedProxies, | 520 profile_prefs_.SetUserPref(::proxy_config::prefs::kUseSharedProxies, |
| 520 new base::FundamentalValue(false)); | 521 new base::FundamentalValue(false)); |
| 521 profile_prefs_.SetManagedPref(prefs::kOpenNetworkConfiguration, | 522 profile_prefs_.SetManagedPref(::onc::prefs::kOpenNetworkConfiguration, |
| 522 network_configs.release()); | 523 network_configs.release()); |
| 523 | 524 |
| 524 net::ProxyConfig actual_config; | 525 net::ProxyConfig actual_config; |
| 525 SyncGetLatestProxyConfig(&actual_config); | 526 SyncGetLatestProxyConfig(&actual_config); |
| 526 net::ProxyConfig expected_config = | 527 net::ProxyConfig expected_config = |
| 527 net::ProxyConfig::CreateFromCustomPacURL(GURL("http://domain.com/x")); | 528 net::ProxyConfig::CreateFromCustomPacURL(GURL("http://domain.com/x")); |
| 528 EXPECT_TRUE(expected_config.Equals(actual_config)); | 529 EXPECT_TRUE(expected_config.Equals(actual_config)); |
| 529 } | 530 } |
| 530 | 531 |
| 531 } // namespace chromeos | 532 } // namespace chromeos |
| OLD | NEW |