| 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { | 127 TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { |
| 128 command_line_.AppendSwitchASCII(switches::kProxyBypassList, "123"); | 128 command_line_.AppendSwitchASCII(switches::kProxyBypassList, "123"); |
| 129 command_line_.AppendSwitchASCII(switches::kProxyServer, "789"); | 129 command_line_.AppendSwitchASCII(switches::kProxyServer, "789"); |
| 130 std::unique_ptr<base::Value> mode_name( | 130 std::unique_ptr<base::Value> mode_name( |
| 131 new base::StringValue(ProxyPrefs::kFixedServersProxyModeName)); | 131 new base::StringValue(ProxyPrefs::kFixedServersProxyModeName)); |
| 132 PolicyMap policy; | 132 PolicyMap policy; |
| 133 policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 133 policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 134 POLICY_SOURCE_CLOUD, std::move(mode_name), nullptr); | 134 POLICY_SOURCE_CLOUD, std::move(mode_name), nullptr); |
| 135 policy.Set(key::kProxyBypassList, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 135 policy.Set(key::kProxyBypassList, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 136 POLICY_SOURCE_CLOUD, | 136 POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("abc"), |
| 137 base::WrapUnique(new base::StringValue("abc")), nullptr); | 137 nullptr); |
| 138 policy.Set(key::kProxyServer, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 138 policy.Set(key::kProxyServer, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 139 POLICY_SOURCE_CLOUD, | 139 POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("ghi"), |
| 140 base::WrapUnique(new base::StringValue("ghi")), nullptr); | 140 nullptr); |
| 141 provider_.UpdateChromePolicy(policy); | 141 provider_.UpdateChromePolicy(policy); |
| 142 | 142 |
| 143 // First verify that command-line options are set correctly when | 143 // First verify that command-line options are set correctly when |
| 144 // there is no policy in effect. | 144 // there is no policy in effect. |
| 145 std::unique_ptr<PrefService> prefs(CreatePrefService(false)); | 145 std::unique_ptr<PrefService> prefs(CreatePrefService(false)); |
| 146 ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy)); | 146 ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy)); |
| 147 assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS); | 147 assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS); |
| 148 assertProxyServer(dict, "789"); | 148 assertProxyServer(dict, "789"); |
| 149 assertPacUrl(dict, std::string()); | 149 assertPacUrl(dict, std::string()); |
| 150 assertBypassList(dict, "123"); | 150 assertBypassList(dict, "123"); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // Try a second time time with the managed PrefStore in place, the | 232 // Try a second time time with the managed PrefStore in place, the |
| 233 // auto-detect should be overridden. The default pref store must be | 233 // auto-detect should be overridden. The default pref store must be |
| 234 // in place with the appropriate default value for this to work. | 234 // in place with the appropriate default value for this to work. |
| 235 prefs = CreatePrefService(true); | 235 prefs = CreatePrefService(true); |
| 236 ProxyConfigDictionary dict2( | 236 ProxyConfigDictionary dict2( |
| 237 prefs->GetDictionary(proxy_config::prefs::kProxy)); | 237 prefs->GetDictionary(proxy_config::prefs::kProxy)); |
| 238 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); | 238 assertProxyModeWithoutParams(dict2, ProxyPrefs::MODE_DIRECT); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace policy | 241 } // namespace policy |
| OLD | NEW |