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/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "components/prefs/testing_pref_service.h" | 13 #include "components/prefs/testing_pref_service.h" |
13 #include "components/ssl_config/ssl_config_prefs.h" | 14 #include "components/ssl_config/ssl_config_prefs.h" |
14 #include "components/ssl_config/ssl_config_service_manager.h" | 15 #include "components/ssl_config/ssl_config_service_manager.h" |
15 #include "components/ssl_config/ssl_config_switches.h" | 16 #include "components/ssl_config/ssl_config_switches.h" |
16 #include "net/ssl/ssl_config.h" | 17 #include "net/ssl/ssl_config.h" |
17 #include "net/ssl/ssl_config_service.h" | 18 #include "net/ssl/ssl_config_service.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 &local_state, base::ThreadTaskRunnerHandle::Get())); | 191 &local_state, base::ThreadTaskRunnerHandle::Get())); |
191 ASSERT_TRUE(config_manager.get()); | 192 ASSERT_TRUE(config_manager.get()); |
192 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 193 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
193 ASSERT_TRUE(config_service.get()); | 194 ASSERT_TRUE(config_service.get()); |
194 | 195 |
195 SSLConfig ssl_config; | 196 SSLConfig ssl_config; |
196 config_service->GetSSLConfig(&ssl_config); | 197 config_service->GetSSLConfig(&ssl_config); |
197 // The command-line option must not have been honored. | 198 // The command-line option must not have been honored. |
198 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_2, ssl_config.version_fallback_min); | 199 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_2, ssl_config.version_fallback_min); |
199 } | 200 } |
201 | |
202 // Tests that DHE may be re-enabled via features. | |
203 TEST_F(SSLConfigServiceManagerPrefTest, DHEFeature) { | |
204 // Toggle the feature. | |
205 base::FeatureList::ClearInstanceForTesting(); | |
Ryan Sleevi
2016/06/15 01:23:25
Doesn't the end of this test leave DHE enabled? Wh
davidben
2016/06/15 19:21:20
The whole point of this test is to make sure the F
davidben
2016/06/15 19:49:18
I started trying to put this together, but there's
| |
206 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | |
207 feature_list->InitializeFromCommandLine("DHECiphers", std::string()); | |
208 base::FeatureList::SetInstance(std::move(feature_list)); | |
209 | |
210 TestingPrefServiceSimple local_state; | |
211 SSLConfigServiceManager::RegisterPrefs(local_state.registry()); | |
212 | |
213 std::unique_ptr<SSLConfigServiceManager> config_manager( | |
214 SSLConfigServiceManager::CreateDefaultManager( | |
215 &local_state, base::ThreadTaskRunnerHandle::Get())); | |
216 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | |
217 ASSERT_TRUE(config_service.get()); | |
218 | |
219 // The feature should have switched the default version_fallback_min value. | |
220 SSLConfig ssl_config; | |
221 config_service->GetSSLConfig(&ssl_config); | |
222 EXPECT_TRUE(ssl_config.dhe_enabled); | |
223 } | |
OLD | NEW |