Chromium Code Reviews| Index: components/security_state/content/content_utils_unittest.cc |
| diff --git a/components/security_state/content/content_utils_unittest.cc b/components/security_state/content/content_utils_unittest.cc |
| index 622c4465d2aa95da144bc5be4ded2c438d6b31ac..5e2871a807b524944049573eb4e6a1a598fbb192 100644 |
| --- a/components/security_state/content/content_utils_unittest.cc |
| +++ b/components/security_state/content/content_utils_unittest.cc |
| @@ -203,7 +203,7 @@ TEST(SecurityStateContentUtilsTest, ConnectionExplanation) { |
| } |
| // Tests that a security level of HTTP_SHOW_WARNING produces a |
| -// content::SecurityStyle of UNAUTHENTICATED, with an explanation. |
| +// content::SecurityStyle of UNAUTHENTICATED and an explanation if appropriate. |
|
estark
2017/03/02 22:53:33
"content::SecurityStyle" is out of date (sorry) --
elawrence
2017/03/02 23:11:43
Done.
|
| TEST(SecurityStateContentUtilsTest, HTTPWarning) { |
| security_state::SecurityInfo security_info; |
| content::SecurityStyleExplanations explanations; |
| @@ -211,36 +211,25 @@ TEST(SecurityStateContentUtilsTest, HTTPWarning) { |
| blink::WebSecurityStyle security_style = |
| GetSecurityStyle(security_info, &explanations); |
| EXPECT_EQ(blink::WebSecurityStyleUnauthenticated, security_style); |
| - EXPECT_EQ(1u, explanations.unauthenticated_explanations.size()); |
| -} |
| + // Verify no explanation was shown, because Form Not Secure was not triggered. |
| + EXPECT_EQ(0u, explanations.unauthenticated_explanations.size()); |
| -// Tests that a security level of NONE when there is a password or |
| -// credit card field on HTTP produces a content::SecurityStyle of |
| -// UNAUTHENTICATED, with an info explanation for each. |
| -TEST(SecurityStateContentUtilsTest, HTTPWarningInFuture) { |
| - security_state::SecurityInfo security_info; |
| - content::SecurityStyleExplanations explanations; |
| - security_info.security_level = security_state::NONE; |
| - security_info.displayed_password_field_on_http = true; |
| - blink::WebSecurityStyle security_style = |
| - GetSecurityStyle(security_info, &explanations); |
| - EXPECT_EQ(blink::WebSecurityStyleUnauthenticated, security_style); |
| - EXPECT_EQ(1u, explanations.info_explanations.size()); |
| - |
| - explanations.info_explanations.clear(); |
| + explanations.unauthenticated_explanations.clear(); |
| security_info.displayed_credit_card_field_on_http = true; |
| security_style = GetSecurityStyle(security_info, &explanations); |
| EXPECT_EQ(blink::WebSecurityStyleUnauthenticated, security_style); |
| - EXPECT_EQ(1u, explanations.info_explanations.size()); |
| + // Verify one explanation was shown, because Form Not Secure was triggered. |
| + EXPECT_EQ(1u, explanations.unauthenticated_explanations.size()); |
| // Check that when both password and credit card fields get displayed, only |
| // one explanation is added. |
| - explanations.info_explanations.clear(); |
| + explanations.unauthenticated_explanations.clear(); |
| security_info.displayed_credit_card_field_on_http = true; |
| security_info.displayed_password_field_on_http = true; |
| security_style = GetSecurityStyle(security_info, &explanations); |
| EXPECT_EQ(blink::WebSecurityStyleUnauthenticated, security_style); |
| - EXPECT_EQ(1u, explanations.info_explanations.size()); |
| + // Verify only one explanation was shown when Form Not Secure is triggered. |
| + EXPECT_EQ(1u, explanations.unauthenticated_explanations.size()); |
| } |
| } // namespace |