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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 &version_min_str)); | 165 &version_min_str)); |
166 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, | 166 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, |
167 &version_max_str)); | 167 &version_max_str)); |
168 } | 168 } |
169 | 169 |
170 // Test that command-line settings for minimum and maximum SSL versions are | 170 // Test that command-line settings for minimum and maximum SSL versions are |
171 // respected and that they do not persist to the preferences files. | 171 // respected and that they do not persist to the preferences files. |
172 TEST_F(SSLConfigServiceManagerPrefTest, CommandLinePrefs) { | 172 TEST_F(SSLConfigServiceManagerPrefTest, CommandLinePrefs) { |
173 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore()); | 173 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore()); |
174 | 174 |
175 CommandLine command_line(CommandLine::NO_PROGRAM); | 175 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
176 command_line.AppendSwitchASCII(switches::kSSLVersionMin, "tls1"); | 176 command_line.AppendSwitchASCII(switches::kSSLVersionMin, "tls1"); |
177 command_line.AppendSwitchASCII(switches::kSSLVersionMax, "ssl3"); | 177 command_line.AppendSwitchASCII(switches::kSSLVersionMax, "ssl3"); |
178 | 178 |
179 PrefServiceMockFactory factory; | 179 PrefServiceMockFactory factory; |
180 factory.set_user_prefs(local_state_store); | 180 factory.set_user_prefs(local_state_store); |
181 factory.SetCommandLine(&command_line); | 181 factory.SetCommandLine(&command_line); |
182 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; | 182 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; |
183 scoped_ptr<PrefService> local_state(factory.Create(registry.get())); | 183 scoped_ptr<PrefService> local_state(factory.Create(registry.get())); |
184 | 184 |
185 SSLConfigServiceManager::RegisterPrefs(registry.get()); | 185 SSLConfigServiceManager::RegisterPrefs(registry.get()); |
(...skipping 19 matching lines...) Expand all Loading... |
205 local_state->FindPreference(prefs::kSSLVersionMax); | 205 local_state->FindPreference(prefs::kSSLVersionMax); |
206 EXPECT_FALSE(version_max_pref->IsUserModifiable()); | 206 EXPECT_FALSE(version_max_pref->IsUserModifiable()); |
207 | 207 |
208 std::string version_min_str; | 208 std::string version_min_str; |
209 std::string version_max_str; | 209 std::string version_max_str; |
210 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, | 210 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, |
211 &version_min_str)); | 211 &version_min_str)); |
212 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, | 212 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, |
213 &version_max_str)); | 213 &version_max_str)); |
214 } | 214 } |
OLD | NEW |