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/ui/webui/options/preferences_browsertest.h" | 5 #include "chrome/browser/ui/webui/options/preferences_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <iostream> | 9 #include <iostream> |
10 #include <memory> | 10 #include <memory> |
11 #include <sstream> | 11 #include <sstream> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
15 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 16 #include "base/memory/ptr_util.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
23 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
24 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
25 #include "components/policy/core/browser/browser_policy_connector.h" | 26 #include "components/policy/core/browser/browser_policy_connector.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 &policy_provider_); | 198 &policy_provider_); |
198 } | 199 } |
199 | 200 |
200 void PreferencesBrowserTest::SetUserPolicies( | 201 void PreferencesBrowserTest::SetUserPolicies( |
201 const std::vector<std::string>& names, | 202 const std::vector<std::string>& names, |
202 const std::vector<base::Value*>& values, | 203 const std::vector<base::Value*>& values, |
203 policy::PolicyLevel level) { | 204 policy::PolicyLevel level) { |
204 policy::PolicyMap map; | 205 policy::PolicyMap map; |
205 for (size_t i = 0; i < names.size(); ++i) { | 206 for (size_t i = 0; i < names.size(); ++i) { |
206 map.Set(names[i], level, policy::POLICY_SCOPE_USER, | 207 map.Set(names[i], level, policy::POLICY_SCOPE_USER, |
207 policy::POLICY_SOURCE_CLOUD, values[i]->DeepCopy(), nullptr); | 208 policy::POLICY_SOURCE_CLOUD, values[i]->CreateDeepCopy(), nullptr); |
208 } | 209 } |
209 policy_provider_.UpdateChromePolicy(map); | 210 policy_provider_.UpdateChromePolicy(map); |
210 } | 211 } |
211 | 212 |
212 void PreferencesBrowserTest::ClearUserPolicies() { | 213 void PreferencesBrowserTest::ClearUserPolicies() { |
213 policy::PolicyMap empty_policy_map; | 214 policy::PolicyMap empty_policy_map; |
214 policy_provider_.UpdateChromePolicy(empty_policy_map); | 215 policy_provider_.UpdateChromePolicy(empty_policy_map); |
215 } | 216 } |
216 | 217 |
217 void PreferencesBrowserTest::SetUserValues( | 218 void PreferencesBrowserTest::SetUserValues( |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 " \"Authentication\": \"None\" }," | 874 " \"Authentication\": \"None\" }," |
874 " \"ProxySettings\": {" | 875 " \"ProxySettings\": {" |
875 " \"PAC\": \"http://domain.com/x\"," | 876 " \"PAC\": \"http://domain.com/x\"," |
876 " \"Type\": \"PAC\" }" | 877 " \"Type\": \"PAC\" }" |
877 " }" | 878 " }" |
878 " ]," | 879 " ]," |
879 " \"Type\": \"UnencryptedConfiguration\"" | 880 " \"Type\": \"UnencryptedConfiguration\"" |
880 "}"; | 881 "}"; |
881 | 882 |
882 policy::PolicyMap map; | 883 policy::PolicyMap map; |
883 map.Set(policy_name, | 884 map.Set(policy_name, policy::POLICY_LEVEL_MANDATORY, scope, |
884 policy::POLICY_LEVEL_MANDATORY, | |
885 scope, | |
886 policy::POLICY_SOURCE_CLOUD, | 885 policy::POLICY_SOURCE_CLOUD, |
887 new base::StringValue(onc_policy), | 886 base::WrapUnique(new base::StringValue(onc_policy)), nullptr); |
888 NULL); | |
889 policy_provider_.UpdateChromePolicy(map); | 887 policy_provider_.UpdateChromePolicy(map); |
890 | 888 |
891 content::RunAllPendingInMessageLoop(); | 889 content::RunAllPendingInMessageLoop(); |
892 } | 890 } |
893 | 891 |
894 const chromeos::NetworkState* GetDefaultNetwork() { | 892 const chromeos::NetworkState* GetDefaultNetwork() { |
895 chromeos::NetworkStateHandler* handler = | 893 chromeos::NetworkStateHandler* handler = |
896 chromeos::NetworkHandler::Get()->network_state_handler(); | 894 chromeos::NetworkHandler::Get()->network_state_handler(); |
897 return handler->DefaultNetwork(); | 895 return handler->DefaultNetwork(); |
898 } | 896 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 SetProxyPref(chromeos::kProxyHttpsPort, base::FundamentalValue(2)); | 1080 SetProxyPref(chromeos::kProxyHttpsPort, base::FundamentalValue(2)); |
1083 SetProxyPref(chromeos::kProxyFtpPort, base::FundamentalValue(3)); | 1081 SetProxyPref(chromeos::kProxyFtpPort, base::FundamentalValue(3)); |
1084 SetProxyPref(chromeos::kProxySocksPort, base::FundamentalValue(4)); | 1082 SetProxyPref(chromeos::kProxySocksPort, base::FundamentalValue(4)); |
1085 | 1083 |
1086 VerifyCurrentProxyServer( | 1084 VerifyCurrentProxyServer( |
1087 "http=a.com:1;https=4.3.2.1:2;ftp=c.com:3;socks=socks4://d.com:4", | 1085 "http=a.com:1;https=4.3.2.1:2;ftp=c.com:3;socks=socks4://d.com:4", |
1088 onc::ONC_SOURCE_NONE); | 1086 onc::ONC_SOURCE_NONE); |
1089 } | 1087 } |
1090 | 1088 |
1091 #endif | 1089 #endif |
OLD | NEW |