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> |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 const std::unique_ptr<base::Value>& value, | 253 const std::unique_ptr<base::Value>& value, |
254 const std::string& controlledBy, | 254 const std::string& controlledBy, |
255 bool disabled, | 255 bool disabled, |
256 bool uncommitted) { | 256 bool uncommitted) { |
257 const base::Value* pref = NULL; | 257 const base::Value* pref = NULL; |
258 const base::DictionaryValue* dict = NULL; | 258 const base::DictionaryValue* dict = NULL; |
259 ASSERT_TRUE(prefs->GetWithoutPathExpansion(name, &pref)); | 259 ASSERT_TRUE(prefs->GetWithoutPathExpansion(name, &pref)); |
260 ASSERT_TRUE(pref->GetAsDictionary(&dict)); | 260 ASSERT_TRUE(pref->GetAsDictionary(&dict)); |
261 VerifyKeyValue(*dict, "value", *value); | 261 VerifyKeyValue(*dict, "value", *value); |
262 if (!controlledBy.empty()) | 262 if (!controlledBy.empty()) |
263 VerifyKeyValue(*dict, "controlledBy", base::StringValue(controlledBy)); | 263 VerifyKeyValue(*dict, "controlledBy", base::Value(controlledBy)); |
264 else | 264 else |
265 EXPECT_FALSE(dict->HasKey("controlledBy")); | 265 EXPECT_FALSE(dict->HasKey("controlledBy")); |
266 | 266 |
267 if (disabled) | 267 if (disabled) |
268 VerifyKeyValue(*dict, "disabled", base::Value(true)); | 268 VerifyKeyValue(*dict, "disabled", base::Value(true)); |
269 else if (dict->HasKey("disabled")) | 269 else if (dict->HasKey("disabled")) |
270 VerifyKeyValue(*dict, "disabled", base::Value(false)); | 270 VerifyKeyValue(*dict, "disabled", base::Value(false)); |
271 | 271 |
272 if (uncommitted) | 272 if (uncommitted) |
273 VerifyKeyValue(*dict, "uncommitted", base::Value(true)); | 273 VerifyKeyValue(*dict, "uncommitted", base::Value(true)); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 // CoreChromeOSOptionsHandler class. | 682 // CoreChromeOSOptionsHandler class. |
683 IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, ChromeOSDeviceFetchPrefs) { | 683 IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, ChromeOSDeviceFetchPrefs) { |
684 std::string observed_json; | 684 std::string observed_json; |
685 | 685 |
686 // Boolean pref. | 686 // Boolean pref. |
687 pref_names_.push_back(chromeos::kAccountsPrefAllowGuest); | 687 pref_names_.push_back(chromeos::kAccountsPrefAllowGuest); |
688 default_values_.push_back(base::MakeUnique<base::Value>(true)); | 688 default_values_.push_back(base::MakeUnique<base::Value>(true)); |
689 | 689 |
690 // String pref. | 690 // String pref. |
691 pref_names_.push_back(chromeos::kReleaseChannel); | 691 pref_names_.push_back(chromeos::kReleaseChannel); |
692 default_values_.push_back(base::MakeUnique<base::StringValue>("")); | 692 default_values_.push_back(base::MakeUnique<base::Value>("")); |
693 | 693 |
694 // List pref. | 694 // List pref. |
695 pref_names_.push_back(chromeos::kAccountsPrefUsers); | 695 pref_names_.push_back(chromeos::kAccountsPrefUsers); |
696 default_values_.push_back(base::MakeUnique<base::ListValue>()); | 696 default_values_.push_back(base::MakeUnique<base::ListValue>()); |
697 | 697 |
698 // Verify notifications when default values are in effect. | 698 // Verify notifications when default values are in effect. |
699 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); | 699 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); |
700 VerifyObservedPrefs(observed_json, pref_names_, default_values_, "owner", | 700 VerifyObservedPrefs(observed_json, pref_names_, default_values_, "owner", |
701 true, false); | 701 true, false); |
702 } | 702 } |
703 | 703 |
704 // Verifies that initializing the JavaScript Preferences class fires the correct | 704 // Verifies that initializing the JavaScript Preferences class fires the correct |
705 // notifications in JavaScript for non-privileged pref values handled by the | 705 // notifications in JavaScript for non-privileged pref values handled by the |
706 // CoreChromeOSOptionsHandler class. | 706 // CoreChromeOSOptionsHandler class. |
707 IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, | 707 IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, |
708 ChromeOSDeviceFetchNonPrivilegedPrefs) { | 708 ChromeOSDeviceFetchNonPrivilegedPrefs) { |
709 std::vector<std::unique_ptr<base::Value>> decorated_non_default_values; | 709 std::vector<std::unique_ptr<base::Value>> decorated_non_default_values; |
710 std::string observed_json; | 710 std::string observed_json; |
711 | 711 |
712 // Non-privileged string pref. | 712 // Non-privileged string pref. |
713 pref_names_.push_back(chromeos::kSystemTimezone); | 713 pref_names_.push_back(chromeos::kSystemTimezone); |
714 default_values_.push_back( | 714 default_values_.push_back( |
715 base::MakeUnique<base::StringValue>("America/Los_Angeles")); | 715 base::MakeUnique<base::Value>("America/Los_Angeles")); |
716 non_default_values_.push_back( | 716 non_default_values_.push_back( |
717 base::MakeUnique<base::StringValue>("America/New_York")); | 717 base::MakeUnique<base::Value>("America/New_York")); |
718 decorated_non_default_values.push_back( | 718 decorated_non_default_values.push_back( |
719 non_default_values_.back()->CreateDeepCopy()); | 719 non_default_values_.back()->CreateDeepCopy()); |
720 | 720 |
721 // Verify notifications when default values are in effect. | 721 // Verify notifications when default values are in effect. |
722 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); | 722 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); |
723 VerifyObservedPrefs(observed_json, pref_names_, default_values_, | 723 VerifyObservedPrefs(observed_json, pref_names_, default_values_, |
724 std::string(), false, false); | 724 std::string(), false, false); |
725 | 725 |
726 chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get(); | 726 chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get(); |
727 cros_settings->Set(pref_names_[0], *non_default_values_[0]); | 727 cros_settings->Set(pref_names_[0], *non_default_values_[0]); |
(...skipping 29 matching lines...) Expand all Loading... |
757 | 757 |
758 // Boolean pref. | 758 // Boolean pref. |
759 pref_names_.push_back(chromeos::kAccountsPrefAllowGuest); | 759 pref_names_.push_back(chromeos::kAccountsPrefAllowGuest); |
760 non_default_values_.push_back(base::MakeUnique<base::Value>(false)); | 760 non_default_values_.push_back(base::MakeUnique<base::Value>(false)); |
761 decorated_non_default_values.push_back( | 761 decorated_non_default_values.push_back( |
762 non_default_values_.back()->CreateDeepCopy()); | 762 non_default_values_.back()->CreateDeepCopy()); |
763 | 763 |
764 // String pref. | 764 // String pref. |
765 pref_names_.push_back(chromeos::kReleaseChannel); | 765 pref_names_.push_back(chromeos::kReleaseChannel); |
766 non_default_values_.push_back( | 766 non_default_values_.push_back( |
767 base::MakeUnique<base::StringValue>("stable-channel")); | 767 base::MakeUnique<base::Value>("stable-channel")); |
768 decorated_non_default_values.push_back( | 768 decorated_non_default_values.push_back( |
769 non_default_values_.back()->CreateDeepCopy()); | 769 non_default_values_.back()->CreateDeepCopy()); |
770 | 770 |
771 // List pref. | 771 // List pref. |
772 pref_names_.push_back(chromeos::kAccountsPrefUsers); | 772 pref_names_.push_back(chromeos::kAccountsPrefUsers); |
773 auto list = base::MakeUnique<base::ListValue>(); | 773 auto list = base::MakeUnique<base::ListValue>(); |
774 list->AppendString("me@google.com"); | 774 list->AppendString("me@google.com"); |
775 list->AppendString("you@google.com"); | 775 list->AppendString("you@google.com"); |
776 non_default_values_.push_back(std::move(list)); | 776 non_default_values_.push_back(std::move(list)); |
777 list = base::MakeUnique<base::ListValue>(); | 777 list = base::MakeUnique<base::ListValue>(); |
(...skipping 26 matching lines...) Expand all Loading... |
804 // notifications in JavaScript for non-privileged pref values handled by the | 804 // notifications in JavaScript for non-privileged pref values handled by the |
805 // CoreChromeOSOptionsHandler class for a managed device. | 805 // CoreChromeOSOptionsHandler class for a managed device. |
806 IN_PROC_BROWSER_TEST_F(ManagedPreferencesBrowserTest, | 806 IN_PROC_BROWSER_TEST_F(ManagedPreferencesBrowserTest, |
807 ChromeOSDeviceFetchNonPrivilegedPrefs) { | 807 ChromeOSDeviceFetchNonPrivilegedPrefs) { |
808 std::vector<std::unique_ptr<base::Value>> decorated_non_default_values; | 808 std::vector<std::unique_ptr<base::Value>> decorated_non_default_values; |
809 std::string observed_json; | 809 std::string observed_json; |
810 | 810 |
811 // Non-privileged string pref. | 811 // Non-privileged string pref. |
812 pref_names_.push_back(chromeos::kSystemTimezone); | 812 pref_names_.push_back(chromeos::kSystemTimezone); |
813 non_default_values_.push_back( | 813 non_default_values_.push_back( |
814 base::MakeUnique<base::StringValue>("America/New_York")); | 814 base::MakeUnique<base::Value>("America/New_York")); |
815 decorated_non_default_values.push_back( | 815 decorated_non_default_values.push_back( |
816 non_default_values_.back()->CreateDeepCopy()); | 816 non_default_values_.back()->CreateDeepCopy()); |
817 | 817 |
818 // Verify notifications when mandatory values are in effect. | 818 // Verify notifications when mandatory values are in effect. |
819 chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get(); | 819 chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get(); |
820 cros_settings->Set(pref_names_[0], *non_default_values_[0]); | 820 cros_settings->Set(pref_names_[0], *non_default_values_[0]); |
821 | 821 |
822 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); | 822 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); |
823 VerifyObservedPrefs(observed_json, pref_names_, decorated_non_default_values, | 823 VerifyObservedPrefs(observed_json, pref_names_, decorated_non_default_values, |
824 std::string(), false, false); | 824 std::string(), false, false); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 | 865 |
866 profile_test->AddProfile(kUserProfilePath, "user"); | 866 profile_test->AddProfile(kUserProfilePath, "user"); |
867 | 867 |
868 service_test->ClearServices(); | 868 service_test->ClearServices(); |
869 service_test->AddService("stub_ethernet", | 869 service_test->AddService("stub_ethernet", |
870 "stub_ethernet_guid", | 870 "stub_ethernet_guid", |
871 "eth0", | 871 "eth0", |
872 shill::kTypeEthernet, | 872 shill::kTypeEthernet, |
873 shill::kStateOnline, | 873 shill::kStateOnline, |
874 true /* add_to_visible */ ); | 874 true /* add_to_visible */ ); |
875 service_test->SetServiceProperty("stub_ethernet", | 875 service_test->SetServiceProperty("stub_ethernet", shill::kProfileProperty, |
876 shill::kProfileProperty, | 876 base::Value(kUserProfilePath)); |
877 base::StringValue(kUserProfilePath)); | |
878 profile_test->AddService(kUserProfilePath, "stub_wifi2"); | 877 profile_test->AddService(kUserProfilePath, "stub_wifi2"); |
879 } | 878 } |
880 | 879 |
881 void SetONCPolicy(const char* policy_name, policy::PolicyScope scope) { | 880 void SetONCPolicy(const char* policy_name, policy::PolicyScope scope) { |
882 std::string onc_policy = | 881 std::string onc_policy = |
883 "{ \"NetworkConfigurations\": [" | 882 "{ \"NetworkConfigurations\": [" |
884 " { \"GUID\": \"stub_ethernet_guid\"," | 883 " { \"GUID\": \"stub_ethernet_guid\"," |
885 " \"Type\": \"Ethernet\"," | 884 " \"Type\": \"Ethernet\"," |
886 " \"Name\": \"My Ethernet\"," | 885 " \"Name\": \"My Ethernet\"," |
887 " \"Ethernet\": {" | 886 " \"Ethernet\": {" |
888 " \"Authentication\": \"None\" }," | 887 " \"Authentication\": \"None\" }," |
889 " \"ProxySettings\": {" | 888 " \"ProxySettings\": {" |
890 " \"PAC\": \"http://domain.com/x\"," | 889 " \"PAC\": \"http://domain.com/x\"," |
891 " \"Type\": \"PAC\" }" | 890 " \"Type\": \"PAC\" }" |
892 " }" | 891 " }" |
893 " ]," | 892 " ]," |
894 " \"Type\": \"UnencryptedConfiguration\"" | 893 " \"Type\": \"UnencryptedConfiguration\"" |
895 "}"; | 894 "}"; |
896 | 895 |
897 policy::PolicyMap map; | 896 policy::PolicyMap map; |
898 map.Set(policy_name, policy::POLICY_LEVEL_MANDATORY, scope, | 897 map.Set(policy_name, policy::POLICY_LEVEL_MANDATORY, scope, |
899 policy::POLICY_SOURCE_CLOUD, | 898 policy::POLICY_SOURCE_CLOUD, |
900 base::MakeUnique<base::StringValue>(onc_policy), nullptr); | 899 base::MakeUnique<base::Value>(onc_policy), nullptr); |
901 policy_provider_.UpdateChromePolicy(map); | 900 policy_provider_.UpdateChromePolicy(map); |
902 | 901 |
903 content::RunAllPendingInMessageLoop(); | 902 content::RunAllPendingInMessageLoop(); |
904 } | 903 } |
905 | 904 |
906 const chromeos::NetworkState* GetDefaultNetwork() { | 905 const chromeos::NetworkState* GetDefaultNetwork() { |
907 chromeos::NetworkStateHandler* handler = | 906 chromeos::NetworkStateHandler* handler = |
908 chromeos::NetworkHandler::Get()->network_state_handler(); | 907 chromeos::NetworkHandler::Get()->network_state_handler(); |
909 return handler->DefaultNetwork(); | 908 return handler->DefaultNetwork(); |
910 } | 909 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 pref_names_.push_back(chromeos::proxy_cros_settings_parser::kProxySingle); | 952 pref_names_.push_back(chromeos::proxy_cros_settings_parser::kProxySingle); |
954 non_default_values_.push_back(base::MakeUnique<base::Value>(true)); | 953 non_default_values_.push_back(base::MakeUnique<base::Value>(true)); |
955 | 954 |
956 // Integer prefs. | 955 // Integer prefs. |
957 pref_names_.push_back( | 956 pref_names_.push_back( |
958 chromeos::proxy_cros_settings_parser::kProxySingleHttpPort); | 957 chromeos::proxy_cros_settings_parser::kProxySingleHttpPort); |
959 non_default_values_.push_back(base::MakeUnique<base::Value>(8080)); | 958 non_default_values_.push_back(base::MakeUnique<base::Value>(8080)); |
960 | 959 |
961 // String pref. | 960 // String pref. |
962 pref_names_.push_back(chromeos::proxy_cros_settings_parser::kProxySingleHttp); | 961 pref_names_.push_back(chromeos::proxy_cros_settings_parser::kProxySingleHttp); |
963 non_default_values_.push_back( | 962 non_default_values_.push_back(base::MakeUnique<base::Value>("127.0.0.1")); |
964 base::MakeUnique<base::StringValue>("127.0.0.1")); | |
965 | 963 |
966 // List pref. | 964 // List pref. |
967 pref_names_.push_back(chromeos::proxy_cros_settings_parser::kProxyIgnoreList); | 965 pref_names_.push_back(chromeos::proxy_cros_settings_parser::kProxyIgnoreList); |
968 auto list = base::MakeUnique<base::ListValue>(); | 966 auto list = base::MakeUnique<base::ListValue>(); |
969 list->AppendString("*.google.com"); | 967 list->AppendString("*.google.com"); |
970 list->AppendString("1.2.3.4:22"); | 968 list->AppendString("1.2.3.4:22"); |
971 non_default_values_.push_back(std::move(list)); | 969 non_default_values_.push_back(std::move(list)); |
972 | 970 |
973 // Verify that no policy is presented to the UI. This must be verified on the | 971 // Verify that no policy is presented to the UI. This must be verified on the |
974 // kProxyType and the kUseSharedProxies prefs. | 972 // kProxyType and the kUseSharedProxies prefs. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 pref_names_.push_back(proxy_config::prefs::kUseSharedProxies); | 1027 pref_names_.push_back(proxy_config::prefs::kUseSharedProxies); |
1030 non_default_values_.push_back(base::MakeUnique<base::Value>(false)); | 1028 non_default_values_.push_back(base::MakeUnique<base::Value>(false)); |
1031 | 1029 |
1032 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); | 1030 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); |
1033 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, "", | 1031 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, "", |
1034 false, false); | 1032 false, false); |
1035 } | 1033 } |
1036 | 1034 |
1037 IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, UserProxyPolicy) { | 1035 IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, UserProxyPolicy) { |
1038 policy_names_.push_back(policy::key::kProxyMode); | 1036 policy_names_.push_back(policy::key::kProxyMode); |
1039 default_values_.push_back(base::MakeUnique<base::StringValue>( | 1037 default_values_.push_back( |
1040 ProxyPrefs::kAutoDetectProxyModeName)); | 1038 base::MakeUnique<base::Value>(ProxyPrefs::kAutoDetectProxyModeName)); |
1041 SetUserPolicies(policy_names_, default_values_, | 1039 SetUserPolicies(policy_names_, default_values_, |
1042 policy::POLICY_LEVEL_MANDATORY); | 1040 policy::POLICY_LEVEL_MANDATORY); |
1043 content::RunAllPendingInMessageLoop(); | 1041 content::RunAllPendingInMessageLoop(); |
1044 | 1042 |
1045 // Verify that the policy is presented to the UI. This verification must be | 1043 // Verify that the policy is presented to the UI. This verification must be |
1046 // done on the kProxyType pref. | 1044 // done on the kProxyType pref. |
1047 pref_names_.push_back(chromeos::proxy_cros_settings_parser::kProxyType); | 1045 pref_names_.push_back(chromeos::proxy_cros_settings_parser::kProxyType); |
1048 non_default_values_.push_back(base::MakeUnique<base::Value>(3)); | 1046 non_default_values_.push_back(base::MakeUnique<base::Value>(3)); |
1049 | 1047 |
1050 // Verify that 'use-shared-proxies' is controlled by the policy. | 1048 // Verify that 'use-shared-proxies' is controlled by the policy. |
1051 pref_names_.push_back(proxy_config::prefs::kUseSharedProxies); | 1049 pref_names_.push_back(proxy_config::prefs::kUseSharedProxies); |
1052 non_default_values_.push_back(base::MakeUnique<base::Value>(false)); | 1050 non_default_values_.push_back(base::MakeUnique<base::Value>(false)); |
1053 | 1051 |
1054 std::string observed_json; | 1052 std::string observed_json; |
1055 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); | 1053 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); |
1056 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, "policy", | 1054 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, "policy", |
1057 true, false); | 1055 true, false); |
1058 } | 1056 } |
1059 | 1057 |
1060 // Verifies that modifications to the proxy settings are correctly pushed from | 1058 // Verifies that modifications to the proxy settings are correctly pushed from |
1061 // JavaScript to the ProxyConfig property stored in the network configuration. | 1059 // JavaScript to the ProxyConfig property stored in the network configuration. |
1062 IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, ChromeOSSetProxy) { | 1060 IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, ChromeOSSetProxy) { |
1063 ASSERT_NO_FATAL_FAILURE(SetupJavaScriptTestEnvironment(pref_names_, NULL)); | 1061 ASSERT_NO_FATAL_FAILURE(SetupJavaScriptTestEnvironment(pref_names_, NULL)); |
1064 | 1062 |
1065 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySingleHttpPort, | 1063 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySingleHttpPort, |
1066 base::Value(123)); | 1064 base::Value(123)); |
1067 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySingleHttp, | 1065 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySingleHttp, |
1068 base::StringValue("www.adomain.xy")); | 1066 base::Value("www.adomain.xy")); |
1069 | 1067 |
1070 VerifyCurrentProxyServer("www.adomain.xy:123", | 1068 VerifyCurrentProxyServer("www.adomain.xy:123", |
1071 onc::ONC_SOURCE_NONE); | 1069 onc::ONC_SOURCE_NONE); |
1072 } | 1070 } |
1073 | 1071 |
1074 // Verify that default proxy ports are used and that ports can be updated | 1072 // Verify that default proxy ports are used and that ports can be updated |
1075 // without affecting the previously set hosts. | 1073 // without affecting the previously set hosts. |
1076 IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, ChromeOSProxyDefaultPorts) { | 1074 IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, ChromeOSProxyDefaultPorts) { |
1077 ASSERT_NO_FATAL_FAILURE(SetupJavaScriptTestEnvironment(pref_names_, NULL)); | 1075 ASSERT_NO_FATAL_FAILURE(SetupJavaScriptTestEnvironment(pref_names_, NULL)); |
1078 | 1076 |
1079 // Set to manual, per scheme proxy. | 1077 // Set to manual, per scheme proxy. |
1080 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySingle, | 1078 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySingle, |
1081 base::Value(false)); | 1079 base::Value(false)); |
1082 | 1080 |
1083 // Set hosts but no ports. | 1081 // Set hosts but no ports. |
1084 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyHttpUrl, | 1082 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyHttpUrl, |
1085 base::StringValue("a.com")); | 1083 base::Value("a.com")); |
1086 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyHttpsUrl, | 1084 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyHttpsUrl, |
1087 base::StringValue("4.3.2.1")); | 1085 base::Value("4.3.2.1")); |
1088 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyFtpUrl, | 1086 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyFtpUrl, |
1089 base::StringValue("c.com")); | 1087 base::Value("c.com")); |
1090 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySocks, | 1088 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySocks, |
1091 base::StringValue("d.com")); | 1089 base::Value("d.com")); |
1092 | 1090 |
1093 // Verify default ports. | 1091 // Verify default ports. |
1094 VerifyCurrentProxyServer( | 1092 VerifyCurrentProxyServer( |
1095 "http=a.com:80;https=4.3.2.1:80;ftp=c.com:80;socks=socks4://d.com:1080", | 1093 "http=a.com:80;https=4.3.2.1:80;ftp=c.com:80;socks=socks4://d.com:1080", |
1096 onc::ONC_SOURCE_NONE); | 1094 onc::ONC_SOURCE_NONE); |
1097 | 1095 |
1098 // Set and verify the ports. | 1096 // Set and verify the ports. |
1099 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyHttpPort, | 1097 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyHttpPort, |
1100 base::Value(1)); | 1098 base::Value(1)); |
1101 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyHttpsPort, | 1099 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyHttpsPort, |
1102 base::Value(2)); | 1100 base::Value(2)); |
1103 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyFtpPort, | 1101 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxyFtpPort, |
1104 base::Value(3)); | 1102 base::Value(3)); |
1105 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySocksPort, | 1103 SetProxyPref(chromeos::proxy_cros_settings_parser::kProxySocksPort, |
1106 base::Value(4)); | 1104 base::Value(4)); |
1107 | 1105 |
1108 VerifyCurrentProxyServer( | 1106 VerifyCurrentProxyServer( |
1109 "http=a.com:1;https=4.3.2.1:2;ftp=c.com:3;socks=socks4://d.com:4", | 1107 "http=a.com:1;https=4.3.2.1:2;ftp=c.com:3;socks=socks4://d.com:4", |
1110 onc::ONC_SOURCE_NONE); | 1108 onc::ONC_SOURCE_NONE); |
1111 } | 1109 } |
1112 | 1110 |
1113 #endif | 1111 #endif |
OLD | NEW |