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

Unified Diff: components/security_state/security_state_model_unittest.cc

Issue 2453063002: Use correct histogram name in security_state_model (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 59d668b78374a541c1c39f7627663395b7ce975f..599431ca8fac42e37eb8e5ef3c6b8571d7f73a62 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,27 @@ 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) {
+ 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;
+
+ base::HistogramTester histograms;
+
estark 2016/10/26 19:53:27 nit: I'd suggest creating the HistogramTester at t
+ model.GetSecurityInfo(&security_info);
+
+ histograms.ExpectUniqueSample("SSL.MarkHttpAsStatus",
+ 2/*HTTP_SHOW_WARNING*/, 1);
estark 2016/10/26 19:53:27 nit: whitespace should be: 2 /* HTTP_SHOW_WARNING
+}
+
} // 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