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/feature_list.h" |
8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "components/prefs/testing_pref_service.h" | 14 #include "components/prefs/testing_pref_service.h" |
14 #include "components/ssl_config/ssl_config_prefs.h" | 15 #include "components/ssl_config/ssl_config_prefs.h" |
15 #include "components/ssl_config/ssl_config_service_manager.h" | 16 #include "components/ssl_config/ssl_config_service_manager.h" |
16 #include "components/ssl_config/ssl_config_switches.h" | 17 #include "components/ssl_config/ssl_config_switches.h" |
17 #include "net/ssl/ssl_config.h" | 18 #include "net/ssl/ssl_config.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 &local_state, base::ThreadTaskRunnerHandle::Get())); | 192 &local_state, base::ThreadTaskRunnerHandle::Get())); |
192 ASSERT_TRUE(config_manager.get()); | 193 ASSERT_TRUE(config_manager.get()); |
193 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 194 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
194 ASSERT_TRUE(config_service.get()); | 195 ASSERT_TRUE(config_service.get()); |
195 | 196 |
196 SSLConfig ssl_config; | 197 SSLConfig ssl_config; |
197 config_service->GetSSLConfig(&ssl_config); | 198 config_service->GetSSLConfig(&ssl_config); |
198 // The command-line option must not have been honored. | 199 // The command-line option must not have been honored. |
199 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_2, ssl_config.version_fallback_min); | 200 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_2, ssl_config.version_fallback_min); |
200 } | 201 } |
| 202 |
| 203 // Tests that DHE may be re-enabled via features. |
| 204 TEST_F(SSLConfigServiceManagerPrefTest, DHEFeature) { |
| 205 // Toggle the feature. |
| 206 base::FeatureList::ClearInstanceForTesting(); |
| 207 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 208 feature_list->InitializeFromCommandLine("DHECiphers", std::string()); |
| 209 base::FeatureList::SetInstance(std::move(feature_list)); |
| 210 |
| 211 TestingPrefServiceSimple local_state; |
| 212 SSLConfigServiceManager::RegisterPrefs(local_state.registry()); |
| 213 |
| 214 std::unique_ptr<SSLConfigServiceManager> config_manager( |
| 215 SSLConfigServiceManager::CreateDefaultManager( |
| 216 &local_state, base::ThreadTaskRunnerHandle::Get())); |
| 217 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
| 218 ASSERT_TRUE(config_service.get()); |
| 219 |
| 220 // The feature should have switched the default version_fallback_min value. |
| 221 SSLConfig ssl_config; |
| 222 config_service->GetSSLConfig(&ssl_config); |
| 223 EXPECT_TRUE(ssl_config.dhe_enabled); |
| 224 } |
OLD | NEW |