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/net/ssl_config_service_manager.h" | 5 #include "chrome/browser/net/ssl_config_service_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // * without --enable-unrestricted-ssl3-fallback, | 162 // * without --enable-unrestricted-ssl3-fallback, |
163 // |unrestricted_ssl3_fallback_enabled| is false. | 163 // |unrestricted_ssl3_fallback_enabled| is false. |
164 // TODO(thaidn): |unrestricted_ssl3_fallback_enabled| is true by default | 164 // TODO(thaidn): |unrestricted_ssl3_fallback_enabled| is true by default |
165 // temporarily until we have fixed deployment issues. | 165 // temporarily until we have fixed deployment issues. |
166 TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) { | 166 TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) { |
167 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore()); | 167 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore()); |
168 | 168 |
169 PrefServiceMockBuilder builder; | 169 PrefServiceMockBuilder builder; |
170 builder.WithUserPrefs(local_state_store.get()); | 170 builder.WithUserPrefs(local_state_store.get()); |
171 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; | 171 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; |
172 scoped_ptr<PrefService> local_state(builder.Create(registry)); | 172 scoped_ptr<PrefService> local_state(builder.Create(registry.get())); |
173 | 173 |
174 SSLConfigServiceManager::RegisterPrefs(registry); | 174 SSLConfigServiceManager::RegisterPrefs(registry.get()); |
175 | 175 |
176 scoped_ptr<SSLConfigServiceManager> config_manager( | 176 scoped_ptr<SSLConfigServiceManager> config_manager( |
177 SSLConfigServiceManager::CreateDefaultManager(local_state.get())); | 177 SSLConfigServiceManager::CreateDefaultManager(local_state.get())); |
178 ASSERT_TRUE(config_manager.get()); | 178 ASSERT_TRUE(config_manager.get()); |
179 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 179 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
180 ASSERT_TRUE(config_service.get()); | 180 ASSERT_TRUE(config_service.get()); |
181 | 181 |
182 SSLConfig ssl_config; | 182 SSLConfig ssl_config; |
183 config_service->GetSSLConfig(&ssl_config); | 183 config_service->GetSSLConfig(&ssl_config); |
184 // The default value in the absence of command-line options is that | 184 // The default value in the absence of command-line options is that |
(...skipping 29 matching lines...) Expand all Loading... |
214 | 214 |
215 CommandLine command_line(CommandLine::NO_PROGRAM); | 215 CommandLine command_line(CommandLine::NO_PROGRAM); |
216 command_line.AppendSwitchASCII(switches::kSSLVersionMin, "tls1"); | 216 command_line.AppendSwitchASCII(switches::kSSLVersionMin, "tls1"); |
217 command_line.AppendSwitchASCII(switches::kSSLVersionMax, "ssl3"); | 217 command_line.AppendSwitchASCII(switches::kSSLVersionMax, "ssl3"); |
218 command_line.AppendSwitch(switches::kEnableUnrestrictedSSL3Fallback); | 218 command_line.AppendSwitch(switches::kEnableUnrestrictedSSL3Fallback); |
219 | 219 |
220 PrefServiceMockBuilder builder; | 220 PrefServiceMockBuilder builder; |
221 builder.WithUserPrefs(local_state_store.get()); | 221 builder.WithUserPrefs(local_state_store.get()); |
222 builder.WithCommandLine(&command_line); | 222 builder.WithCommandLine(&command_line); |
223 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; | 223 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; |
224 scoped_ptr<PrefService> local_state(builder.Create(registry)); | 224 scoped_ptr<PrefService> local_state(builder.Create(registry.get())); |
225 | 225 |
226 SSLConfigServiceManager::RegisterPrefs(registry); | 226 SSLConfigServiceManager::RegisterPrefs(registry.get()); |
227 | 227 |
228 scoped_ptr<SSLConfigServiceManager> config_manager( | 228 scoped_ptr<SSLConfigServiceManager> config_manager( |
229 SSLConfigServiceManager::CreateDefaultManager(local_state.get())); | 229 SSLConfigServiceManager::CreateDefaultManager(local_state.get())); |
230 ASSERT_TRUE(config_manager.get()); | 230 ASSERT_TRUE(config_manager.get()); |
231 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 231 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
232 ASSERT_TRUE(config_service.get()); | 232 ASSERT_TRUE(config_service.get()); |
233 | 233 |
234 SSLConfig ssl_config; | 234 SSLConfig ssl_config; |
235 config_service->GetSSLConfig(&ssl_config); | 235 config_service->GetSSLConfig(&ssl_config); |
236 // Command-line flags should be respected. | 236 // Command-line flags should be respected. |
(...skipping 18 matching lines...) Expand all Loading... |
255 std::string version_max_str; | 255 std::string version_max_str; |
256 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, | 256 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, |
257 &version_min_str)); | 257 &version_min_str)); |
258 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, | 258 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, |
259 &version_max_str)); | 259 &version_max_str)); |
260 bool unrestricted_ssl3_fallback_enabled; | 260 bool unrestricted_ssl3_fallback_enabled; |
261 EXPECT_FALSE(local_state_store->GetBoolean( | 261 EXPECT_FALSE(local_state_store->GetBoolean( |
262 prefs::kEnableUnrestrictedSSL3Fallback, | 262 prefs::kEnableUnrestrictedSSL3Fallback, |
263 &unrestricted_ssl3_fallback_enabled)); | 263 &unrestricted_ssl3_fallback_enabled)); |
264 } | 264 } |
OLD | NEW |