Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: components/security_state/content/content_utils_unittest.cc

Issue 2727353002: Ensure GetSecurityStyle sets correct explanations for HTTP_SHOW_WARNING (Closed)
Patch Set: Address estark feedback Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/security_state/content/content_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..41395a8e3ba9cc5f04c77d572b2c0f50bd24eab9 100644
--- a/components/security_state/content/content_utils_unittest.cc
+++ b/components/security_state/content/content_utils_unittest.cc
@@ -202,8 +202,8 @@ TEST(SecurityStateContentUtilsTest, ConnectionExplanation) {
}
}
-// Tests that a security level of HTTP_SHOW_WARNING produces a
-// content::SecurityStyle of UNAUTHENTICATED, with an explanation.
+// Tests that a security level of HTTP_SHOW_WARNING produces
+// blink::WebSecurityStyleUnauthenticated and an explanation if appropriate.
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
« no previous file with comments | « components/security_state/content/content_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698