Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(873)

Side by Side Diff: chrome/browser/net/ssl_config_service_manager_pref_unittest.cc

Issue 208713004: Move SSLConfig class from ssl_config_service.h to ssl_config.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 config_service->GetSSLConfig(&config); 141 config_service->GetSSLConfig(&config);
142 142
143 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites); 143 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites);
144 ASSERT_EQ(2u, config.disabled_cipher_suites.size()); 144 ASSERT_EQ(2u, config.disabled_cipher_suites.size());
145 EXPECT_EQ(0x0004, config.disabled_cipher_suites[0]); 145 EXPECT_EQ(0x0004, config.disabled_cipher_suites[0]);
146 EXPECT_EQ(0x0005, config.disabled_cipher_suites[1]); 146 EXPECT_EQ(0x0005, config.disabled_cipher_suites[1]);
147 } 147 }
148 148
149 // Test that 149 // Test that
150 // * without command-line settings for minimum and maximum SSL versions, 150 // * without command-line settings for minimum and maximum SSL versions,
151 // SSL 3.0 ~ default_version_max() are enabled; 151 // SSL 3.0 ~ kDefaultSSLVersionMax are enabled;
152 // * without --enable-unrestricted-ssl3-fallback, 152 // * without --enable-unrestricted-ssl3-fallback,
153 // |unrestricted_ssl3_fallback_enabled| is false. 153 // |unrestricted_ssl3_fallback_enabled| is false.
154 TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) { 154 TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) {
155 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore()); 155 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore());
156 156
157 PrefServiceMockFactory factory; 157 PrefServiceMockFactory factory;
158 factory.set_user_prefs(local_state_store); 158 factory.set_user_prefs(local_state_store);
159 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; 159 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple;
160 scoped_ptr<PrefService> local_state(factory.Create(registry.get())); 160 scoped_ptr<PrefService> local_state(factory.Create(registry.get()));
161 161
162 SSLConfigServiceManager::RegisterPrefs(registry.get()); 162 SSLConfigServiceManager::RegisterPrefs(registry.get());
163 163
164 scoped_ptr<SSLConfigServiceManager> config_manager( 164 scoped_ptr<SSLConfigServiceManager> config_manager(
165 SSLConfigServiceManager::CreateDefaultManager(local_state.get())); 165 SSLConfigServiceManager::CreateDefaultManager(local_state.get()));
166 ASSERT_TRUE(config_manager.get()); 166 ASSERT_TRUE(config_manager.get());
167 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); 167 scoped_refptr<SSLConfigService> config_service(config_manager->Get());
168 ASSERT_TRUE(config_service.get()); 168 ASSERT_TRUE(config_service.get());
169 169
170 SSLConfig ssl_config; 170 SSLConfig ssl_config;
171 config_service->GetSSLConfig(&ssl_config); 171 config_service->GetSSLConfig(&ssl_config);
172 // The default value in the absence of command-line options is that 172 // The default value in the absence of command-line options is that
173 // SSL 3.0 ~ default_version_max() are enabled. 173 // SSL 3.0 ~ kDefaultSSLVersionMax are enabled.
174 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_SSL3, ssl_config.version_min); 174 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_SSL3, ssl_config.version_min);
175 EXPECT_EQ(net::SSLConfigService::default_version_max(), 175 EXPECT_EQ(net::kDefaultSSLVersionMax, ssl_config.version_max);
176 ssl_config.version_max);
177 EXPECT_FALSE(ssl_config.unrestricted_ssl3_fallback_enabled); 176 EXPECT_FALSE(ssl_config.unrestricted_ssl3_fallback_enabled);
178 177
179 // The settings should not be added to the local_state. 178 // The settings should not be added to the local_state.
180 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMin)); 179 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMin));
181 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMax)); 180 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMax));
182 EXPECT_FALSE(local_state->HasPrefPath( 181 EXPECT_FALSE(local_state->HasPrefPath(
183 prefs::kEnableUnrestrictedSSL3Fallback)); 182 prefs::kEnableUnrestrictedSSL3Fallback));
184 183
185 // Explicitly double-check the settings are not in the preference store. 184 // Explicitly double-check the settings are not in the preference store.
186 std::string version_min_str; 185 std::string version_min_str;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 std::string version_max_str; 242 std::string version_max_str;
244 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, 243 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin,
245 &version_min_str)); 244 &version_min_str));
246 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, 245 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax,
247 &version_max_str)); 246 &version_max_str));
248 bool unrestricted_ssl3_fallback_enabled; 247 bool unrestricted_ssl3_fallback_enabled;
249 EXPECT_FALSE(local_state_store->GetBoolean( 248 EXPECT_FALSE(local_state_store->GetBoolean(
250 prefs::kEnableUnrestrictedSSL3Fallback, 249 prefs::kEnableUnrestrictedSSL3Fallback,
251 &unrestricted_ssl3_fallback_enabled)); 250 &unrestricted_ssl3_fallback_enabled));
252 } 251 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698