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