Chromium Code Reviews| 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/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/content_settings/host_content_settings_map.h" | |
| 11 #include "chrome/browser/prefs/pref_service_mock_builder.h" | 12 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
| 12 #include "chrome/browser/prefs/testing_pref_store.h" | 13 #include "chrome/browser/prefs/testing_pref_store.h" |
| 13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/content_settings.h" | |
| 14 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/test/base/testing_pref_service.h" | 17 #include "chrome/test/base/testing_pref_service.h" |
| 18 #include "chrome/test/base/testing_profile.h" | |
| 16 #include "content/public/test/test_browser_thread.h" | 19 #include "content/public/test/test_browser_thread.h" |
| 17 #include "net/base/ssl_config_service.h" | 20 #include "net/base/ssl_config_service.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 22 |
| 20 using base::ListValue; | 23 using base::ListValue; |
| 21 using base::Value; | 24 using base::Value; |
| 22 using content::BrowserThread; | 25 using content::BrowserThread; |
| 23 using net::SSLConfig; | 26 using net::SSLConfig; |
| 24 using net::SSLConfigService; | 27 using net::SSLConfigService; |
| 25 | 28 |
| 29 namespace { | |
| 30 | |
| 31 void SetCookiePref(TestingProfile* profile, ContentSetting setting) { | |
| 32 HostContentSettingsMap* host_content_settings_map = | |
| 33 profile->GetHostContentSettingsMap(); | |
| 34 host_content_settings_map->SetDefaultContentSetting( | |
| 35 CONTENT_SETTINGS_TYPE_COOKIES, setting); | |
| 36 } | |
| 37 | |
| 38 } // namespace | |
| 39 | |
| 26 class SSLConfigServiceManagerPrefTest : public testing::Test { | 40 class SSLConfigServiceManagerPrefTest : public testing::Test { |
| 27 public: | 41 public: |
| 28 SSLConfigServiceManagerPrefTest() | 42 SSLConfigServiceManagerPrefTest() |
| 29 : ui_thread_(BrowserThread::UI, &message_loop_), | 43 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 30 io_thread_(BrowserThread::IO, &message_loop_) {} | 44 io_thread_(BrowserThread::IO, &message_loop_) {} |
| 31 | 45 |
| 32 protected: | 46 protected: |
| 47 bool IsChannelIdEnabled( | |
| 48 const scoped_refptr<SSLConfigService>& config_service) { | |
|
wtc
2012/09/11 22:21:03
It seems that this parameter can be declared more
mattm
2012/09/12 03:37:44
done
| |
| 49 // Pump the message loop to notify the SSLConfigServiceManagerPref that the | |
| 50 // preferences changed. | |
| 51 message_loop_.RunAllPending(); | |
| 52 SSLConfig config; | |
| 53 config_service->GetSSLConfig(&config); | |
| 54 return config.channel_id_enabled; | |
| 55 } | |
| 56 | |
| 33 MessageLoop message_loop_; | 57 MessageLoop message_loop_; |
| 34 content::TestBrowserThread ui_thread_; | 58 content::TestBrowserThread ui_thread_; |
| 35 content::TestBrowserThread io_thread_; | 59 content::TestBrowserThread io_thread_; |
| 36 }; | 60 }; |
| 37 | 61 |
| 62 // Test channel id with no user prefs. | |
| 63 TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithoutUserPrefs) { | |
| 64 TestingPrefService local_state; | |
| 65 SSLConfigServiceManager::RegisterPrefs(&local_state); | |
| 66 local_state.SetUserPref(prefs::kEnableOriginBoundCerts, | |
| 67 Value::CreateBooleanValue(false)); | |
| 68 | |
| 69 scoped_ptr<SSLConfigServiceManager> config_manager( | |
| 70 SSLConfigServiceManager::CreateDefaultManager(&local_state, NULL)); | |
| 71 ASSERT_TRUE(config_manager.get()); | |
| 72 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | |
| 73 ASSERT_TRUE(config_service.get()); | |
| 74 | |
| 75 SSLConfig config; | |
| 76 config_service->GetSSLConfig(&config); | |
| 77 EXPECT_FALSE(config.channel_id_enabled); | |
| 78 | |
| 79 local_state.SetUserPref(prefs::kEnableOriginBoundCerts, | |
| 80 Value::CreateBooleanValue(true)); | |
| 81 // Pump the message loop to notify the SSLConfigServiceManagerPref that the | |
| 82 // preferences changed. | |
| 83 message_loop_.RunAllPending(); | |
| 84 config_service->GetSSLConfig(&config); | |
| 85 EXPECT_TRUE(config.channel_id_enabled); | |
| 86 } | |
| 87 | |
| 88 // Test channel id with user prefs. | |
| 89 TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithUserPrefs) { | |
| 90 TestingPrefService local_state; | |
| 91 SSLConfigServiceManager::RegisterPrefs(&local_state); | |
| 92 local_state.SetUserPref(prefs::kEnableOriginBoundCerts, | |
| 93 Value::CreateBooleanValue(false)); | |
| 94 | |
| 95 TestingProfile testing_profile; | |
| 96 TestingPrefService* user_prefs = testing_profile.GetTestingPrefService(); | |
| 97 SetCookiePref(&testing_profile, CONTENT_SETTING_BLOCK); | |
| 98 user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | |
| 99 Value::CreateBooleanValue(true)); | |
| 100 | |
| 101 scoped_ptr<SSLConfigServiceManager> config_manager( | |
| 102 SSLConfigServiceManager::CreateDefaultManager(&local_state, user_prefs)); | |
| 103 ASSERT_TRUE(config_manager.get()); | |
| 104 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | |
| 105 ASSERT_TRUE(config_service.get()); | |
| 106 | |
| 107 // channelid=false, cookies=block, 3rdpartycookies=block | |
| 108 EXPECT_FALSE(IsChannelIdEnabled(config_service)); | |
| 109 | |
| 110 // channelid=false, cookies=block, 3rdpartycookies=allow | |
| 111 user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | |
| 112 Value::CreateBooleanValue(false)); | |
| 113 EXPECT_FALSE(IsChannelIdEnabled(config_service)); | |
| 114 | |
| 115 // channelid=false, cookies=allow, 3rdpartycookies=block | |
| 116 SetCookiePref(&testing_profile, CONTENT_SETTING_ALLOW); | |
| 117 user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | |
| 118 Value::CreateBooleanValue(true)); | |
| 119 EXPECT_FALSE(IsChannelIdEnabled(config_service)); | |
| 120 | |
| 121 // channelid=false, cookies=allow, 3rdpartycookies=allow | |
| 122 user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | |
| 123 Value::CreateBooleanValue(false)); | |
| 124 EXPECT_FALSE(IsChannelIdEnabled(config_service)); | |
| 125 | |
| 126 // channelid=true, cookies=block, 3rdpartycookies=block | |
| 127 local_state.SetUserPref(prefs::kEnableOriginBoundCerts, | |
| 128 Value::CreateBooleanValue(true)); | |
| 129 SetCookiePref(&testing_profile, CONTENT_SETTING_BLOCK); | |
| 130 user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | |
| 131 Value::CreateBooleanValue(true)); | |
| 132 EXPECT_FALSE(IsChannelIdEnabled(config_service)); | |
| 133 | |
| 134 // channelid=true, cookies=block, 3rdpartycookies=allow | |
| 135 user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | |
| 136 Value::CreateBooleanValue(false)); | |
| 137 EXPECT_FALSE(IsChannelIdEnabled(config_service)); | |
| 138 | |
| 139 // channelid=true, cookies=allow, 3rdpartycookies=block | |
| 140 SetCookiePref(&testing_profile, CONTENT_SETTING_ALLOW); | |
| 141 user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | |
| 142 Value::CreateBooleanValue(true)); | |
| 143 EXPECT_FALSE(IsChannelIdEnabled(config_service)); | |
| 144 | |
| 145 // channelid=true, cookies=allow, 3rdpartycookies=allow | |
| 146 user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, | |
| 147 Value::CreateBooleanValue(false)); | |
| 148 EXPECT_TRUE(IsChannelIdEnabled(config_service)); | |
| 149 } | |
| 150 | |
| 38 // Test that cipher suites can be disabled. "Good" refers to the fact that | 151 // Test that cipher suites can be disabled. "Good" refers to the fact that |
| 39 // every value is expected to be successfully parsed into a cipher suite. | 152 // every value is expected to be successfully parsed into a cipher suite. |
| 40 TEST_F(SSLConfigServiceManagerPrefTest, GoodDisabledCipherSuites) { | 153 TEST_F(SSLConfigServiceManagerPrefTest, GoodDisabledCipherSuites) { |
| 41 TestingPrefService pref_service; | 154 TestingPrefService local_state; |
| 42 SSLConfigServiceManager::RegisterPrefs(&pref_service); | 155 SSLConfigServiceManager::RegisterPrefs(&local_state); |
| 43 | 156 |
| 44 scoped_ptr<SSLConfigServiceManager> config_manager( | 157 scoped_ptr<SSLConfigServiceManager> config_manager( |
| 45 SSLConfigServiceManager::CreateDefaultManager(&pref_service)); | 158 SSLConfigServiceManager::CreateDefaultManager(&local_state, NULL)); |
| 46 ASSERT_TRUE(config_manager.get()); | 159 ASSERT_TRUE(config_manager.get()); |
| 47 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 160 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
| 48 ASSERT_TRUE(config_service.get()); | 161 ASSERT_TRUE(config_service.get()); |
| 49 | 162 |
| 50 SSLConfig old_config; | 163 SSLConfig old_config; |
| 51 config_service->GetSSLConfig(&old_config); | 164 config_service->GetSSLConfig(&old_config); |
| 52 EXPECT_TRUE(old_config.disabled_cipher_suites.empty()); | 165 EXPECT_TRUE(old_config.disabled_cipher_suites.empty()); |
| 53 | 166 |
| 54 ListValue* list_value = new ListValue(); | 167 ListValue* list_value = new ListValue(); |
| 55 list_value->Append(Value::CreateStringValue("0x0004")); | 168 list_value->Append(Value::CreateStringValue("0x0004")); |
| 56 list_value->Append(Value::CreateStringValue("0x0005")); | 169 list_value->Append(Value::CreateStringValue("0x0005")); |
| 57 pref_service.SetUserPref(prefs::kCipherSuiteBlacklist, list_value); | 170 local_state.SetUserPref(prefs::kCipherSuiteBlacklist, list_value); |
| 58 | 171 |
| 59 // Pump the message loop to notify the SSLConfigServiceManagerPref that the | 172 // Pump the message loop to notify the SSLConfigServiceManagerPref that the |
| 60 // preferences changed. | 173 // preferences changed. |
| 61 message_loop_.RunAllPending(); | 174 message_loop_.RunAllPending(); |
| 62 | 175 |
| 63 SSLConfig config; | 176 SSLConfig config; |
| 64 config_service->GetSSLConfig(&config); | 177 config_service->GetSSLConfig(&config); |
| 65 | 178 |
| 66 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites); | 179 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites); |
| 67 ASSERT_EQ(2u, config.disabled_cipher_suites.size()); | 180 ASSERT_EQ(2u, config.disabled_cipher_suites.size()); |
| 68 EXPECT_EQ(0x0004, config.disabled_cipher_suites[0]); | 181 EXPECT_EQ(0x0004, config.disabled_cipher_suites[0]); |
| 69 EXPECT_EQ(0x0005, config.disabled_cipher_suites[1]); | 182 EXPECT_EQ(0x0005, config.disabled_cipher_suites[1]); |
| 70 } | 183 } |
| 71 | 184 |
| 72 // Test that cipher suites can be disabled. "Bad" refers to the fact that | 185 // Test that cipher suites can be disabled. "Bad" refers to the fact that |
| 73 // there are one or more non-cipher suite strings in the preference. They | 186 // there are one or more non-cipher suite strings in the preference. They |
| 74 // should be ignored. | 187 // should be ignored. |
| 75 TEST_F(SSLConfigServiceManagerPrefTest, BadDisabledCipherSuites) { | 188 TEST_F(SSLConfigServiceManagerPrefTest, BadDisabledCipherSuites) { |
| 76 TestingPrefService pref_service; | 189 TestingPrefService local_state; |
| 77 SSLConfigServiceManager::RegisterPrefs(&pref_service); | 190 SSLConfigServiceManager::RegisterPrefs(&local_state); |
| 78 | 191 |
| 79 scoped_ptr<SSLConfigServiceManager> config_manager( | 192 scoped_ptr<SSLConfigServiceManager> config_manager( |
| 80 SSLConfigServiceManager::CreateDefaultManager(&pref_service)); | 193 SSLConfigServiceManager::CreateDefaultManager(&local_state, NULL)); |
| 81 ASSERT_TRUE(config_manager.get()); | 194 ASSERT_TRUE(config_manager.get()); |
| 82 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 195 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
| 83 ASSERT_TRUE(config_service.get()); | 196 ASSERT_TRUE(config_service.get()); |
| 84 | 197 |
| 85 SSLConfig old_config; | 198 SSLConfig old_config; |
| 86 config_service->GetSSLConfig(&old_config); | 199 config_service->GetSSLConfig(&old_config); |
| 87 EXPECT_TRUE(old_config.disabled_cipher_suites.empty()); | 200 EXPECT_TRUE(old_config.disabled_cipher_suites.empty()); |
| 88 | 201 |
| 89 ListValue* list_value = new ListValue(); | 202 ListValue* list_value = new ListValue(); |
| 90 list_value->Append(Value::CreateStringValue("0x0004")); | 203 list_value->Append(Value::CreateStringValue("0x0004")); |
| 91 list_value->Append(Value::CreateStringValue("TLS_NOT_WITH_A_CIPHER_SUITE")); | 204 list_value->Append(Value::CreateStringValue("TLS_NOT_WITH_A_CIPHER_SUITE")); |
| 92 list_value->Append(Value::CreateStringValue("0x0005")); | 205 list_value->Append(Value::CreateStringValue("0x0005")); |
| 93 list_value->Append(Value::CreateStringValue("0xBEEFY")); | 206 list_value->Append(Value::CreateStringValue("0xBEEFY")); |
| 94 pref_service.SetUserPref(prefs::kCipherSuiteBlacklist, list_value); | 207 local_state.SetUserPref(prefs::kCipherSuiteBlacklist, list_value); |
| 95 | 208 |
| 96 // Pump the message loop to notify the SSLConfigServiceManagerPref that the | 209 // Pump the message loop to notify the SSLConfigServiceManagerPref that the |
| 97 // preferences changed. | 210 // preferences changed. |
| 98 message_loop_.RunAllPending(); | 211 message_loop_.RunAllPending(); |
| 99 | 212 |
| 100 SSLConfig config; | 213 SSLConfig config; |
| 101 config_service->GetSSLConfig(&config); | 214 config_service->GetSSLConfig(&config); |
| 102 | 215 |
| 103 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites); | 216 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites); |
| 104 ASSERT_EQ(2u, config.disabled_cipher_suites.size()); | 217 ASSERT_EQ(2u, config.disabled_cipher_suites.size()); |
| 105 EXPECT_EQ(0x0004, config.disabled_cipher_suites[0]); | 218 EXPECT_EQ(0x0004, config.disabled_cipher_suites[0]); |
| 106 EXPECT_EQ(0x0005, config.disabled_cipher_suites[1]); | 219 EXPECT_EQ(0x0005, config.disabled_cipher_suites[1]); |
| 107 } | 220 } |
| 108 | 221 |
| 109 // Test that without command-line settings for minimum and maximum SSL | 222 // Test that without command-line settings for minimum and maximum SSL |
| 110 // versions, SSL 3.0 ~ default_version_max() are enabled. | 223 // versions, SSL 3.0 ~ default_version_max() are enabled. |
| 111 TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) { | 224 TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) { |
| 112 scoped_refptr<TestingPrefStore> user_prefs(new TestingPrefStore()); | 225 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore()); |
| 113 | 226 |
| 114 PrefServiceMockBuilder builder; | 227 PrefServiceMockBuilder builder; |
| 115 builder.WithUserPrefs(user_prefs.get()); | 228 builder.WithUserPrefs(local_state_store.get()); |
| 116 scoped_ptr<PrefService> pref_service(builder.Create()); | 229 scoped_ptr<PrefService> local_state(builder.Create()); |
| 117 | 230 |
| 118 SSLConfigServiceManager::RegisterPrefs(pref_service.get()); | 231 SSLConfigServiceManager::RegisterPrefs(local_state.get()); |
| 119 | 232 |
| 120 scoped_ptr<SSLConfigServiceManager> config_manager( | 233 scoped_ptr<SSLConfigServiceManager> config_manager( |
| 121 SSLConfigServiceManager::CreateDefaultManager(pref_service.get())); | 234 SSLConfigServiceManager::CreateDefaultManager(local_state.get(), NULL)); |
| 122 ASSERT_TRUE(config_manager.get()); | 235 ASSERT_TRUE(config_manager.get()); |
| 123 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 236 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
| 124 ASSERT_TRUE(config_service.get()); | 237 ASSERT_TRUE(config_service.get()); |
| 125 | 238 |
| 126 SSLConfig ssl_config; | 239 SSLConfig ssl_config; |
| 127 config_service->GetSSLConfig(&ssl_config); | 240 config_service->GetSSLConfig(&ssl_config); |
| 128 // The default value in the absence of command-line options is that | 241 // The default value in the absence of command-line options is that |
| 129 // SSL 3.0 ~ default_version_max() are enabled. | 242 // SSL 3.0 ~ default_version_max() are enabled. |
| 130 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_SSL3, ssl_config.version_min); | 243 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_SSL3, ssl_config.version_min); |
| 131 EXPECT_EQ(net::SSLConfigService::default_version_max(), | 244 EXPECT_EQ(net::SSLConfigService::default_version_max(), |
| 132 ssl_config.version_max); | 245 ssl_config.version_max); |
| 133 | 246 |
| 134 // The user settings should not be added to the pref_service. | 247 // The settings should not be added to the local_state. |
| 135 EXPECT_FALSE(pref_service->HasPrefPath(prefs::kSSLVersionMin)); | 248 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMin)); |
| 136 EXPECT_FALSE(pref_service->HasPrefPath(prefs::kSSLVersionMax)); | 249 EXPECT_FALSE(local_state->HasPrefPath(prefs::kSSLVersionMax)); |
| 137 | 250 |
| 138 // Explicitly double-check the settings are not in the user preference | 251 // Explicitly double-check the settings are not in the preference store. |
| 139 // store. | |
| 140 std::string version_min_str; | 252 std::string version_min_str; |
| 141 std::string version_max_str; | 253 std::string version_max_str; |
| 142 EXPECT_FALSE(user_prefs->GetString(prefs::kSSLVersionMin, &version_min_str)); | 254 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, |
| 143 EXPECT_FALSE(user_prefs->GetString(prefs::kSSLVersionMax, &version_max_str)); | 255 &version_min_str)); |
| 256 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, | |
| 257 &version_max_str)); | |
| 144 } | 258 } |
| 145 | 259 |
| 146 // Test that command-line settings for minimum and maximum SSL versions are | 260 // Test that command-line settings for minimum and maximum SSL versions are |
| 147 // respected and that they do not persist to the user preferences files. | 261 // respected and that they do not persist to the preferences files. |
| 148 TEST_F(SSLConfigServiceManagerPrefTest, CommandLinePrefs) { | 262 TEST_F(SSLConfigServiceManagerPrefTest, CommandLinePrefs) { |
| 149 scoped_refptr<TestingPrefStore> user_prefs(new TestingPrefStore()); | 263 scoped_refptr<TestingPrefStore> local_state_store(new TestingPrefStore()); |
| 150 | 264 |
| 151 CommandLine command_line(CommandLine::NO_PROGRAM); | 265 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 152 command_line.AppendSwitchASCII(switches::kSSLVersionMin, "tls1"); | 266 command_line.AppendSwitchASCII(switches::kSSLVersionMin, "tls1"); |
| 153 command_line.AppendSwitchASCII(switches::kSSLVersionMax, "ssl3"); | 267 command_line.AppendSwitchASCII(switches::kSSLVersionMax, "ssl3"); |
| 154 | 268 |
| 155 PrefServiceMockBuilder builder; | 269 PrefServiceMockBuilder builder; |
| 156 builder.WithUserPrefs(user_prefs.get()); | 270 builder.WithUserPrefs(local_state_store.get()); |
| 157 builder.WithCommandLine(&command_line); | 271 builder.WithCommandLine(&command_line); |
| 158 scoped_ptr<PrefService> pref_service(builder.Create()); | 272 scoped_ptr<PrefService> local_state(builder.Create()); |
| 159 | 273 |
| 160 SSLConfigServiceManager::RegisterPrefs(pref_service.get()); | 274 SSLConfigServiceManager::RegisterPrefs(local_state.get()); |
| 161 | 275 |
| 162 scoped_ptr<SSLConfigServiceManager> config_manager( | 276 scoped_ptr<SSLConfigServiceManager> config_manager( |
| 163 SSLConfigServiceManager::CreateDefaultManager(pref_service.get())); | 277 SSLConfigServiceManager::CreateDefaultManager(local_state.get(), NULL)); |
| 164 ASSERT_TRUE(config_manager.get()); | 278 ASSERT_TRUE(config_manager.get()); |
| 165 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); | 279 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); |
| 166 ASSERT_TRUE(config_service.get()); | 280 ASSERT_TRUE(config_service.get()); |
| 167 | 281 |
| 168 SSLConfig ssl_config; | 282 SSLConfig ssl_config; |
| 169 config_service->GetSSLConfig(&ssl_config); | 283 config_service->GetSSLConfig(&ssl_config); |
| 170 // Command-line flags should be respected. | 284 // Command-line flags should be respected. |
| 171 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1, ssl_config.version_min); | 285 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1, ssl_config.version_min); |
| 172 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_SSL3, ssl_config.version_max); | 286 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_SSL3, ssl_config.version_max); |
| 173 | 287 |
| 174 // Explicitly double-check the settings are not in the user preference | 288 // Explicitly double-check the settings are not in the preference store. |
| 175 // store. | |
| 176 const PrefService::Preference* version_min_pref = | 289 const PrefService::Preference* version_min_pref = |
| 177 pref_service->FindPreference(prefs::kSSLVersionMin); | 290 local_state->FindPreference(prefs::kSSLVersionMin); |
| 178 EXPECT_FALSE(version_min_pref->IsUserModifiable()); | 291 EXPECT_FALSE(version_min_pref->IsUserModifiable()); |
| 179 | 292 |
| 180 const PrefService::Preference* version_max_pref = | 293 const PrefService::Preference* version_max_pref = |
| 181 pref_service->FindPreference(prefs::kSSLVersionMax); | 294 local_state->FindPreference(prefs::kSSLVersionMax); |
| 182 EXPECT_FALSE(version_max_pref->IsUserModifiable()); | 295 EXPECT_FALSE(version_max_pref->IsUserModifiable()); |
| 183 | 296 |
| 184 std::string version_min_str; | 297 std::string version_min_str; |
| 185 std::string version_max_str; | 298 std::string version_max_str; |
| 186 EXPECT_FALSE(user_prefs->GetString(prefs::kSSLVersionMin, &version_min_str)); | 299 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, |
| 187 EXPECT_FALSE(user_prefs->GetString(prefs::kSSLVersionMax, &version_max_str)); | 300 &version_min_str)); |
| 301 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, | |
| 302 &version_max_str)); | |
| 188 } | 303 } |
| OLD | NEW |