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

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

Issue 649413004: net: disable SSLv3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: g cl try Created 6 years, 1 month 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/common/localized_error.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 SSLConfig config; 120 SSLConfig config;
121 config_service->GetSSLConfig(&config); 121 config_service->GetSSLConfig(&config);
122 122
123 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites); 123 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites);
124 ASSERT_EQ(2u, config.disabled_cipher_suites.size()); 124 ASSERT_EQ(2u, config.disabled_cipher_suites.size());
125 EXPECT_EQ(0x0004, config.disabled_cipher_suites[0]); 125 EXPECT_EQ(0x0004, config.disabled_cipher_suites[0]);
126 EXPECT_EQ(0x0005, config.disabled_cipher_suites[1]); 126 EXPECT_EQ(0x0005, config.disabled_cipher_suites[1]);
127 } 127 }
128 128
129 // Test that without command-line settings for minimum and maximum SSL versions, 129 // Test that without command-line settings for minimum and maximum SSL versions,
130 // SSL 3.0 ~ kDefaultSSLVersionMax are enabled. 130 // TLS 1.0 ~ kDefaultSSLVersionMax are enabled.
131 TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) { 131 TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) {
132 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore()); 132 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore());
133 133
134 PrefServiceMockFactory factory; 134 PrefServiceMockFactory factory;
135 factory.set_user_prefs(local_state_store); 135 factory.set_user_prefs(local_state_store);
136 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; 136 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple;
137 scoped_ptr<PrefService> local_state(factory.Create(registry.get())); 137 scoped_ptr<PrefService> local_state(factory.Create(registry.get()));
138 138
139 SSLConfigServiceManager::RegisterPrefs(registry.get()); 139 SSLConfigServiceManager::RegisterPrefs(registry.get());
140 140
141 scoped_ptr<SSLConfigServiceManager> config_manager( 141 scoped_ptr<SSLConfigServiceManager> config_manager(
142 SSLConfigServiceManager::CreateDefaultManager(local_state.get())); 142 SSLConfigServiceManager::CreateDefaultManager(local_state.get()));
143 ASSERT_TRUE(config_manager.get()); 143 ASSERT_TRUE(config_manager.get());
144 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); 144 scoped_refptr<SSLConfigService> config_service(config_manager->Get());
145 ASSERT_TRUE(config_service.get()); 145 ASSERT_TRUE(config_service.get());
146 146
147 SSLConfig ssl_config; 147 SSLConfig ssl_config;
148 config_service->GetSSLConfig(&ssl_config); 148 config_service->GetSSLConfig(&ssl_config);
149 // The default value in the absence of command-line options is that 149 // The default value in the absence of command-line options is that
150 // SSL 3.0 ~ kDefaultSSLVersionMax are enabled. 150 // SSL 3.0 ~ kDefaultSSLVersionMax are enabled.
151 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_SSL3, ssl_config.version_min); 151 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1, ssl_config.version_min);
152 EXPECT_EQ(net::kDefaultSSLVersionMax, ssl_config.version_max); 152 EXPECT_EQ(net::kDefaultSSLVersionMax, ssl_config.version_max);
153 153
154 // The settings should not be added to the local_state. 154 // The settings should not be added to the local_state.
155 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMin)); 155 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMin));
156 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMax)); 156 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMax));
157 157
158 // Explicitly double-check the settings are not in the preference store. 158 // Explicitly double-check the settings are not in the preference store.
159 std::string version_min_str; 159 std::string version_min_str;
160 std::string version_max_str; 160 std::string version_max_str;
161 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, 161 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 local_state->FindPreference(prefs::kSSLVersionMax); 202 local_state->FindPreference(prefs::kSSLVersionMax);
203 EXPECT_FALSE(version_max_pref->IsUserModifiable()); 203 EXPECT_FALSE(version_max_pref->IsUserModifiable());
204 204
205 std::string version_min_str; 205 std::string version_min_str;
206 std::string version_max_str; 206 std::string version_max_str;
207 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, 207 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin,
208 &version_min_str)); 208 &version_min_str));
209 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, 209 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax,
210 &version_max_str)); 210 &version_max_str));
211 } 211 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/common/localized_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698