| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/security_state/security_state_model.h" | 7 #include "components/security_state/security_state_model.h" |
| 8 #include "content/public/browser/security_style_explanation.h" | 8 #include "content/public/browser/security_style_explanation.h" |
| 9 #include "content/public/browser/security_style_explanations.h" | 9 #include "content/public/browser/security_style_explanations.h" |
| 10 #include "net/cert/cert_status_flags.h" | 10 #include "net/cert/cert_status_flags.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 ASSERT_TRUE(FindSecurityStyleExplanation( | 206 ASSERT_TRUE(FindSecurityStyleExplanation( |
| 207 explanations.secure_explanations, "Secure Connection", &explanation)); | 207 explanations.secure_explanations, "Secure Connection", &explanation)); |
| 208 EXPECT_EQ( | 208 EXPECT_EQ( |
| 209 "The connection to this site is encrypted and authenticated using a " | 209 "The connection to this site is encrypted and authenticated using a " |
| 210 "strong protocol (TLS 1.3), a strong key exchange (X25519), and a " | 210 "strong protocol (TLS 1.3), a strong key exchange (X25519), and a " |
| 211 "strong cipher (AES_128_GCM).", | 211 "strong cipher (AES_128_GCM).", |
| 212 explanation.description); | 212 explanation.description); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 // Tests that a security level of HTTP_SHOW_WARNING produces a |
| 217 // content::SecurityStyle of UNAUTHENTICATED, with an explanation. |
| 218 TEST(ChromeSecurityStateModelClientTest, HTTPWarning) { |
| 219 security_state::SecurityStateModel::SecurityInfo security_info; |
| 220 content::SecurityStyleExplanations explanations; |
| 221 security_info.security_level = |
| 222 security_state::SecurityStateModel::HTTP_SHOW_WARNING; |
| 223 blink::WebSecurityStyle security_style = |
| 224 ChromeSecurityStateModelClient::GetSecurityStyle(security_info, |
| 225 &explanations); |
| 226 EXPECT_EQ(blink::WebSecurityStyleUnauthenticated, security_style); |
| 227 EXPECT_EQ(1u, explanations.unauthenticated_explanations.size()); |
| 228 } |
| 229 |
| 230 // Tests that a security level of NONE when there is a password or |
| 231 // credit card field on HTTP produces a content::SecurityStyle of |
| 232 // UNAUTHENTICATED, with an info explanation. |
| 233 TEST(ChromeSecurityStateModelClientTest, HTTPWarningInFuture) { |
| 234 security_state::SecurityStateModel::SecurityInfo security_info; |
| 235 content::SecurityStyleExplanations explanations; |
| 236 security_info.security_level = security_state::SecurityStateModel::NONE; |
| 237 security_info.displayed_private_user_data_input_on_http = true; |
| 238 blink::WebSecurityStyle security_style = |
| 239 ChromeSecurityStateModelClient::GetSecurityStyle(security_info, |
| 240 &explanations); |
| 241 EXPECT_EQ(blink::WebSecurityStyleUnauthenticated, security_style); |
| 242 EXPECT_EQ(1u, explanations.info_explanations.size()); |
| 243 } |
| 244 |
| 216 } // namespace | 245 } // namespace |
| OLD | NEW |