Chromium Code Reviews| 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 |