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

Unified Diff: components/security_state/security_state_model_unittest.cc

Issue 2453063002: Use correct histogram name in security_state_model (Closed)
Patch Set: Fix nits 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 59d668b78374a541c1c39f7627663395b7ce975f..712d1943c0266cb6c3422255e12bfb71a60d7cec 100644
--- a/components/security_state/security_state_model_unittest.cc
+++ b/components/security_state/security_state_model_unittest.cc
@@ -7,6 +7,7 @@
#include <stdint.h>
#include "base/command_line.h"
+#include "base/test/histogram_tester.h"
#include "components/security_state/security_state_model_client.h"
#include "components/security_state/switches.h"
#include "net/cert/x509_certificate.h"
@@ -302,6 +303,24 @@ TEST(SecurityStateModelTest, PrivateUserDataNotSet) {
EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level);
}
+// Tests that SSL.MarkHttpAsStatus histogram is updated when security state is
+// computed for a page containing a password field on HTTP.
+TEST(SecurityStateModelTest, MarkHttpAsStatusHistogram) {
+ const char* kHistogramName = "SSL.MarkHttpAsStatus";
+ base::HistogramTester histograms;
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kMarkHttpAs, switches::kMarkHttpWithPasswordsOrCcWithChip);
+ TestSecurityStateModelClient client;
+ client.UseHttpUrl();
+ SecurityStateModel model;
+ model.SetClient(&client);
+ 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);
+}
+
} // namespace
} // namespace security_state
« 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