| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_security_state_model_client.h" | 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 6 | 6 |
| 7 #include <openssl/ssl.h> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/ssl/cert_verifier_browser_test.h" | 14 #include "chrome/browser/ssl/cert_verifier_browser_test.h" |
| 13 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | 15 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 14 #include "chrome/browser/ssl/ssl_blocking_page.h" | 16 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 15 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 net::SSLConnectionStatusToVersion(security_info.connection_status); | 174 net::SSLConnectionStatusToVersion(security_info.connection_status); |
| 173 net::SSLVersionToString(&protocol, ssl_version); | 175 net::SSLVersionToString(&protocol, ssl_version); |
| 174 bool is_aead; | 176 bool is_aead; |
| 175 uint16_t cipher_suite = | 177 uint16_t cipher_suite = |
| 176 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); | 178 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); |
| 177 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, | 179 net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, |
| 178 cipher_suite); | 180 cipher_suite); |
| 179 EXPECT_TRUE(is_aead); | 181 EXPECT_TRUE(is_aead); |
| 180 EXPECT_EQ(NULL, mac); // The default secure cipher does not have a MAC. | 182 EXPECT_EQ(NULL, mac); // The default secure cipher does not have a MAC. |
| 181 | 183 |
| 184 base::string16 key_exchange_name = base::ASCIIToUTF16(key_exchange); |
| 185 if (security_info.key_exchange_group != 0) { |
| 186 key_exchange_name = l10n_util::GetStringFUTF16( |
| 187 IDS_SSL_KEY_EXCHANGE_WITH_GROUP, key_exchange_name, |
| 188 base::ASCIIToUTF16( |
| 189 SSL_get_curve_name(security_info.key_exchange_group))); |
| 190 } |
| 191 |
| 182 std::vector<base::string16> description_replacements; | 192 std::vector<base::string16> description_replacements; |
| 183 description_replacements.push_back(base::ASCIIToUTF16(protocol)); | 193 description_replacements.push_back(base::ASCIIToUTF16(protocol)); |
| 184 description_replacements.push_back(base::ASCIIToUTF16(key_exchange)); | 194 description_replacements.push_back(key_exchange_name); |
| 185 description_replacements.push_back(base::ASCIIToUTF16(cipher)); | 195 description_replacements.push_back(base::ASCIIToUTF16(cipher)); |
| 186 base::string16 secure_description = l10n_util::GetStringFUTF16( | 196 base::string16 secure_description = l10n_util::GetStringFUTF16( |
| 187 IDS_STRONG_SSL_DESCRIPTION, description_replacements, nullptr); | 197 IDS_STRONG_SSL_DESCRIPTION, description_replacements, nullptr); |
| 188 | 198 |
| 189 EXPECT_EQ(secure_description, | 199 EXPECT_EQ(secure_description, |
| 190 base::ASCIIToUTF16(secure_explanations.back().description)); | 200 base::ASCIIToUTF16(secure_explanations.back().description)); |
| 191 } | 201 } |
| 192 | 202 |
| 193 void CheckSecurityInfoForSecure( | 203 void CheckSecurityInfoForSecure( |
| 194 content::WebContents* contents, | 204 content::WebContents* contents, |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 ChromeSecurityStateModelClient* model_client = | 1405 ChromeSecurityStateModelClient* model_client = |
| 1396 ChromeSecurityStateModelClient::FromWebContents(web_contents); | 1406 ChromeSecurityStateModelClient::FromWebContents(web_contents); |
| 1397 ASSERT_TRUE(model_client); | 1407 ASSERT_TRUE(model_client); |
| 1398 const SecurityStateModel::SecurityInfo& security_info = | 1408 const SecurityStateModel::SecurityInfo& security_info = |
| 1399 model_client->GetSecurityInfo(); | 1409 model_client->GetSecurityInfo(); |
| 1400 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); | 1410 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); |
| 1401 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); | 1411 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); |
| 1402 } | 1412 } |
| 1403 | 1413 |
| 1404 } // namespace | 1414 } // namespace |
| OLD | NEW |