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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 #include "components/policy/core/common/policy_map.h" | 107 #include "components/policy/core/common/policy_map.h" |
108 #include "components/policy/core/common/policy_pref_names.h" | 108 #include "components/policy/core/common/policy_pref_names.h" |
109 #include "components/policy/core/common/policy_service.h" | 109 #include "components/policy/core/common/policy_service.h" |
110 #include "components/policy/core/common/policy_service_impl.h" | 110 #include "components/policy/core/common/policy_service_impl.h" |
111 #include "components/policy/core/common/policy_types.h" | 111 #include "components/policy/core/common/policy_types.h" |
112 #include "components/prefs/pref_service.h" | 112 #include "components/prefs/pref_service.h" |
113 #include "components/search/search.h" | 113 #include "components/search/search.h" |
114 #include "components/search_engines/template_url.h" | 114 #include "components/search_engines/template_url.h" |
115 #include "components/search_engines/template_url_service.h" | 115 #include "components/search_engines/template_url_service.h" |
116 #include "components/security_interstitials/core/controller_client.h" | 116 #include "components/security_interstitials/core/controller_client.h" |
117 #include "components/ssl_config/ssl_config_prefs.h" | |
118 #include "components/strings/grit/components_strings.h" | 117 #include "components/strings/grit/components_strings.h" |
119 #include "components/translate/core/browser/language_state.h" | 118 #include "components/translate/core/browser/language_state.h" |
120 #include "components/translate/core/browser/translate_infobar_delegate.h" | 119 #include "components/translate/core/browser/translate_infobar_delegate.h" |
121 #include "components/variations/service/variations_service.h" | 120 #include "components/variations/service/variations_service.h" |
122 #include "components/version_info/version_info.h" | 121 #include "components/version_info/version_info.h" |
123 #include "content/public/browser/browser_child_process_host_iterator.h" | 122 #include "content/public/browser/browser_child_process_host_iterator.h" |
124 #include "content/public/browser/browser_context.h" | 123 #include "content/public/browser/browser_context.h" |
125 #include "content/public/browser/browser_thread.h" | 124 #include "content/public/browser/browser_thread.h" |
126 #include "content/public/browser/child_process_data.h" | 125 #include "content/public/browser/child_process_data.h" |
127 #include "content/public/browser/download_item.h" | 126 #include "content/public/browser/download_item.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 #include "extensions/browser/scoped_ignore_content_verifier_for_test.h" | 162 #include "extensions/browser/scoped_ignore_content_verifier_for_test.h" |
164 #include "extensions/browser/test_extension_registry_observer.h" | 163 #include "extensions/browser/test_extension_registry_observer.h" |
165 #include "extensions/browser/uninstall_reason.h" | 164 #include "extensions/browser/uninstall_reason.h" |
166 #include "extensions/common/constants.h" | 165 #include "extensions/common/constants.h" |
167 #include "extensions/common/extension.h" | 166 #include "extensions/common/extension.h" |
168 #include "extensions/common/extension_set.h" | 167 #include "extensions/common/extension_set.h" |
169 #include "extensions/common/manifest_handlers/shared_module_info.h" | 168 #include "extensions/common/manifest_handlers/shared_module_info.h" |
170 #include "net/base/net_errors.h" | 169 #include "net/base/net_errors.h" |
171 #include "net/base/url_util.h" | 170 #include "net/base/url_util.h" |
172 #include "net/http/http_stream_factory.h" | 171 #include "net/http/http_stream_factory.h" |
173 #include "net/ssl/ssl_config.h" | |
174 #include "net/ssl/ssl_config_service.h" | |
175 #include "net/test/embedded_test_server/embedded_test_server.h" | 172 #include "net/test/embedded_test_server/embedded_test_server.h" |
176 #include "net/test/url_request/url_request_failed_job.h" | 173 #include "net/test/url_request/url_request_failed_job.h" |
177 #include "net/test/url_request/url_request_mock_http_job.h" | 174 #include "net/test/url_request/url_request_mock_http_job.h" |
178 #include "net/url_request/url_request.h" | 175 #include "net/url_request/url_request.h" |
179 #include "net/url_request/url_request_filter.h" | 176 #include "net/url_request/url_request_filter.h" |
180 #include "net/url_request/url_request_interceptor.h" | 177 #include "net/url_request/url_request_interceptor.h" |
181 #include "policy/policy_constants.h" | 178 #include "policy/policy_constants.h" |
182 #include "testing/gmock/include/gmock/gmock.h" | 179 #include "testing/gmock/include/gmock/gmock.h" |
183 #include "testing/gtest/include/gtest/gtest.h" | 180 #include "testing/gtest/include/gtest/gtest.h" |
184 #include "third_party/WebKit/public/web/WebInputEvent.h" | 181 #include "third_party/WebKit/public/web/WebInputEvent.h" |
(...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 blacklist.AppendString(folder_path); | 2616 blacklist.AppendString(folder_path); |
2620 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 2617 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
2621 POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr); | 2618 POLICY_SOURCE_CLOUD, blacklist.CreateDeepCopy(), nullptr); |
2622 UpdateProviderPolicy(policies); | 2619 UpdateProviderPolicy(policies); |
2623 FlushBlacklistPolicy(); | 2620 FlushBlacklistPolicy(); |
2624 | 2621 |
2625 CheckCanOpenURL(browser(), file_path1.c_str()); | 2622 CheckCanOpenURL(browser(), file_path1.c_str()); |
2626 CheckURLIsBlocked(browser(), file_path2.c_str()); | 2623 CheckURLIsBlocked(browser(), file_path2.c_str()); |
2627 } | 2624 } |
2628 | 2625 |
2629 namespace { | |
2630 | |
2631 void GetSSLVersionFallbackMinOnIOThread( | |
2632 const scoped_refptr<net::SSLConfigService>& config_service, | |
2633 uint16_t* version_fallback_min) { | |
2634 net::SSLConfig config; | |
2635 config_service->GetSSLConfig(&config); | |
2636 *version_fallback_min = config.version_fallback_min; | |
2637 } | |
2638 | |
2639 uint16_t GetSSLVersionFallbackMin(Profile* profile) { | |
2640 scoped_refptr<net::SSLConfigService> config_service( | |
2641 profile->GetSSLConfigService()); | |
2642 uint16_t version_fallback_min; | |
2643 base::RunLoop loop; | |
2644 BrowserThread::PostTaskAndReply( | |
2645 BrowserThread::IO, FROM_HERE, | |
2646 base::Bind(&GetSSLVersionFallbackMinOnIOThread, config_service, | |
2647 base::Unretained(&version_fallback_min)), | |
2648 loop.QuitClosure()); | |
2649 loop.Run(); | |
2650 return version_fallback_min; | |
2651 } | |
2652 | |
2653 } // namespace | |
2654 | |
2655 IN_PROC_BROWSER_TEST_F(PolicyTest, SSLVersionFallbackMin) { | |
2656 PrefService* prefs = g_browser_process->local_state(); | |
2657 | |
2658 const std::string new_value("tls1.1"); | |
2659 const std::string default_value( | |
2660 prefs->GetString(ssl_config::prefs::kSSLVersionFallbackMin)); | |
2661 | |
2662 EXPECT_NE(default_value, new_value); | |
2663 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_2, | |
2664 GetSSLVersionFallbackMin(browser()->profile())); | |
2665 | |
2666 PolicyMap policies; | |
2667 policies.Set(key::kSSLVersionFallbackMin, POLICY_LEVEL_MANDATORY, | |
2668 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | |
2669 base::WrapUnique(new base::StringValue(new_value)), nullptr); | |
2670 UpdateProviderPolicy(policies); | |
2671 | |
2672 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_1, | |
2673 GetSSLVersionFallbackMin(browser()->profile())); | |
2674 } | |
2675 | |
2676 #if !defined(OS_MACOSX) | 2626 #if !defined(OS_MACOSX) |
2677 IN_PROC_BROWSER_TEST_F(PolicyTest, FullscreenAllowedBrowser) { | 2627 IN_PROC_BROWSER_TEST_F(PolicyTest, FullscreenAllowedBrowser) { |
2678 PolicyMap policies; | 2628 PolicyMap policies; |
2679 policies.Set(key::kFullscreenAllowed, POLICY_LEVEL_MANDATORY, | 2629 policies.Set(key::kFullscreenAllowed, POLICY_LEVEL_MANDATORY, |
2680 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 2630 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
2681 base::WrapUnique(new base::FundamentalValue(false)), nullptr); | 2631 base::WrapUnique(new base::FundamentalValue(false)), nullptr); |
2682 UpdateProviderPolicy(policies); | 2632 UpdateProviderPolicy(policies); |
2683 | 2633 |
2684 BrowserWindow* browser_window = browser()->window(); | 2634 BrowserWindow* browser_window = browser()->window(); |
2685 ASSERT_TRUE(browser_window); | 2635 ASSERT_TRUE(browser_window); |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4097 | 4047 |
4098 SetEmptyPolicy(); | 4048 SetEmptyPolicy(); |
4099 // Policy not set. | 4049 // Policy not set. |
4100 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4050 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
4101 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4051 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
4102 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4052 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
4103 } | 4053 } |
4104 #endif // defined(OS_CHROMEOS) | 4054 #endif // defined(OS_CHROMEOS) |
4105 | 4055 |
4106 } // namespace policy | 4056 } // namespace policy |
OLD | NEW |