| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ssl/chrome_ssl_host_state_delegate.h" | 5 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/test/simple_test_clock.h" | 12 #include "base/test/simple_test_clock.h" |
| 12 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 13 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 13 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
| 15 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" | 18 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, | 239 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, |
| 239 std::string(), nullptr); | 240 std::string(), nullptr); |
| 240 | 241 |
| 241 // No exception should exist. | 242 // No exception should exist. |
| 242 EXPECT_FALSE(state->HasAllowException(kWWWGoogleHost)); | 243 EXPECT_FALSE(state->HasAllowException(kWWWGoogleHost)); |
| 243 // Create the old-format one. | 244 // Create the old-format one. |
| 244 map->SetWebsiteSettingCustomScope( | 245 map->SetWebsiteSettingCustomScope( |
| 245 ContentSettingsPattern::FromURLNoWildcard(url), | 246 ContentSettingsPattern::FromURLNoWildcard(url), |
| 246 ContentSettingsPattern::FromURLNoWildcard(url), | 247 ContentSettingsPattern::FromURLNoWildcard(url), |
| 247 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), | 248 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), |
| 248 new_format.Pass()); | 249 std::move(new_format)); |
| 249 | 250 |
| 250 // Test that the old-format setting works. | 251 // Test that the old-format setting works. |
| 251 EXPECT_TRUE(state->HasAllowException(kWWWGoogleHost)); | 252 EXPECT_TRUE(state->HasAllowException(kWWWGoogleHost)); |
| 252 | 253 |
| 253 // Trigger the migration code that happens on construction. | 254 // Trigger the migration code that happens on construction. |
| 254 { | 255 { |
| 255 scoped_ptr<ChromeSSLHostStateDelegate> temp_delegate( | 256 scoped_ptr<ChromeSSLHostStateDelegate> temp_delegate( |
| 256 new ChromeSSLHostStateDelegate(profile)); | 257 new ChromeSSLHostStateDelegate(profile)); |
| 257 } | 258 } |
| 258 | 259 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 EXPECT_EQ( | 620 EXPECT_EQ( |
| 620 content::SSLHostStateDelegate::ALLOWED, | 621 content::SSLHostStateDelegate::ALLOWED, |
| 621 state->QueryPolicy("localhost", *cert, | 622 state->QueryPolicy("localhost", *cert, |
| 622 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); | 623 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); |
| 623 | 624 |
| 624 EXPECT_EQ( | 625 EXPECT_EQ( |
| 625 content::SSLHostStateDelegate::ALLOWED, | 626 content::SSLHostStateDelegate::ALLOWED, |
| 626 state->QueryPolicy("127.0.0.1", *cert, | 627 state->QueryPolicy("127.0.0.1", *cert, |
| 627 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); | 628 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); |
| 628 } | 629 } |
| OLD | NEW |