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

Unified Diff: components/security_state/security_state_model_unittest.cc

Issue 2459883002: Log SSL.MarkHttpAs histogram without regard to state of the page (Closed)
Patch Set: Created 4 years, 2 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/security_state_model.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/security_state_model_unittest.cc
diff --git a/components/security_state/security_state_model_unittest.cc b/components/security_state/security_state_model_unittest.cc
index 712d1943c0266cb6c3422255e12bfb71a60d7cec..7776a0c5ba5e492df8a36efef7d189ad3a2db7c9 100644
--- a/components/security_state/security_state_model_unittest.cc
+++ b/components/security_state/security_state_model_unittest.cc
@@ -304,7 +304,7 @@ TEST(SecurityStateModelTest, PrivateUserDataNotSet) {
}
// Tests that SSL.MarkHttpAsStatus histogram is updated when security state is
-// computed for a page containing a password field on HTTP.
+// computed for a page.
TEST(SecurityStateModelTest, MarkHttpAsStatusHistogram) {
const char* kHistogramName = "SSL.MarkHttpAsStatus";
base::HistogramTester histograms;
@@ -314,11 +314,19 @@ TEST(SecurityStateModelTest, MarkHttpAsStatusHistogram) {
client.UseHttpUrl();
SecurityStateModel model;
model.SetClient(&client);
+
+ // Ensure histogram recorded correctly when a non-secure password input is
+ // found on the page.
client.set_displayed_password_field_on_http(true);
SecurityStateModel::SecurityInfo security_info;
histograms.ExpectTotalCount(kHistogramName, 0);
model.GetSecurityInfo(&security_info);
histograms.ExpectUniqueSample(kHistogramName, 2 /* HTTP_SHOW_WARNING */, 1);
+
+ // Ensure histogram recorded correctly even without a password input.
+ client.set_displayed_password_field_on_http(false);
+ model.GetSecurityInfo(&security_info);
+ histograms.ExpectUniqueSample(kHistogramName, 2 /* HTTP_SHOW_WARNING */, 2);
}
} // namespace
« no previous file with comments | « components/security_state/security_state_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698