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/feature_list.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 ASSERT_TRUE(config_manager.get()); | 172 ASSERT_TRUE(config_manager.get()); |
173 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 173 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
174 ASSERT_TRUE(config_service.get()); | 174 ASSERT_TRUE(config_service.get()); |
175 | 175 |
176 SSLConfig ssl_config; | 176 SSLConfig ssl_config; |
177 config_service->GetSSLConfig(&ssl_config); | 177 config_service->GetSSLConfig(&ssl_config); |
178 // The command-line option must not have been honored. | 178 // The command-line option must not have been honored. |
179 EXPECT_LE(net::SSL_PROTOCOL_VERSION_TLS1, ssl_config.version_min); | 179 EXPECT_LE(net::SSL_PROTOCOL_VERSION_TLS1, ssl_config.version_min); |
180 } | 180 } |
181 | 181 |
182 // Tests that DHE may be re-enabled via features. | |
183 TEST_F(SSLConfigServiceManagerPrefTest, DHEFeature) { | |
184 // Toggle the feature. | |
185 base::test::ScopedFeatureList scoped_feature_list; | |
186 scoped_feature_list.InitFromCommandLine("DHECiphers", std::string()); | |
187 | |
188 TestingPrefServiceSimple local_state; | |
189 SSLConfigServiceManager::RegisterPrefs(local_state.registry()); | |
190 | |
191 std::unique_ptr<SSLConfigServiceManager> config_manager( | |
192 SSLConfigServiceManager::CreateDefaultManager( | |
193 &local_state, base::ThreadTaskRunnerHandle::Get())); | |
194 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | |
195 ASSERT_TRUE(config_service.get()); | |
196 | |
197 // The feature should have switched the default version_fallback_min value. | |
198 SSLConfig ssl_config; | |
199 config_service->GetSSLConfig(&ssl_config); | |
200 EXPECT_TRUE(ssl_config.dhe_enabled); | |
201 } | |
202 | |
203 // Tests that TLS 1.3 may be enabled via features. | 182 // Tests that TLS 1.3 may be enabled via features. |
204 TEST_F(SSLConfigServiceManagerPrefTest, TLS13Feature) { | 183 TEST_F(SSLConfigServiceManagerPrefTest, TLS13Feature) { |
205 // Toggle the feature. | 184 // Toggle the feature. |
206 base::test::ScopedFeatureList scoped_feature_list; | 185 base::test::ScopedFeatureList scoped_feature_list; |
207 scoped_feature_list.InitFromCommandLine("NegotiateTLS13", std::string()); | 186 scoped_feature_list.InitFromCommandLine("NegotiateTLS13", std::string()); |
208 | 187 |
209 TestingPrefServiceSimple local_state; | 188 TestingPrefServiceSimple local_state; |
210 SSLConfigServiceManager::RegisterPrefs(local_state.registry()); | 189 SSLConfigServiceManager::RegisterPrefs(local_state.registry()); |
211 | 190 |
212 std::unique_ptr<SSLConfigServiceManager> config_manager( | 191 std::unique_ptr<SSLConfigServiceManager> config_manager( |
213 SSLConfigServiceManager::CreateDefaultManager( | 192 SSLConfigServiceManager::CreateDefaultManager( |
214 &local_state, base::ThreadTaskRunnerHandle::Get())); | 193 &local_state, base::ThreadTaskRunnerHandle::Get())); |
215 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 194 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
216 ASSERT_TRUE(config_service.get()); | 195 ASSERT_TRUE(config_service.get()); |
217 | 196 |
218 // The feature should have switched the default version_fallback_min value. | 197 // The feature should have switched the default version_fallback_min value. |
219 SSLConfig ssl_config; | 198 SSLConfig ssl_config; |
220 config_service->GetSSLConfig(&ssl_config); | 199 config_service->GetSSLConfig(&ssl_config); |
221 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); | 200 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_3, ssl_config.version_max); |
222 } | 201 } |
OLD | NEW |