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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « components/security_state/security_state_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/security_state/security_state_model.h" 5 #include "components/security_state/security_state_model.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/test/histogram_tester.h"
10 #include "components/security_state/security_state_model_client.h" 11 #include "components/security_state/security_state_model_client.h"
11 #include "components/security_state/switches.h" 12 #include "components/security_state/switches.h"
12 #include "net/cert/x509_certificate.h" 13 #include "net/cert/x509_certificate.h"
13 #include "net/ssl/ssl_cipher_suite_names.h" 14 #include "net/ssl/ssl_cipher_suite_names.h"
14 #include "net/ssl/ssl_connection_status_flags.h" 15 #include "net/ssl/ssl_connection_status_flags.h"
15 #include "net/test/cert_test_util.h" 16 #include "net/test/cert_test_util.h"
16 #include "net/test/test_certificate_data.h" 17 #include "net/test/test_certificate_data.h"
17 #include "net/test/test_data_directory.h" 18 #include "net/test/test_data_directory.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 TestSecurityStateModelClient client; 296 TestSecurityStateModelClient client;
296 client.UseHttpUrl(); 297 client.UseHttpUrl();
297 SecurityStateModel model; 298 SecurityStateModel model;
298 model.SetClient(&client); 299 model.SetClient(&client);
299 SecurityStateModel::SecurityInfo security_info; 300 SecurityStateModel::SecurityInfo security_info;
300 model.GetSecurityInfo(&security_info); 301 model.GetSecurityInfo(&security_info);
301 EXPECT_FALSE(security_info.displayed_private_user_data_input_on_http); 302 EXPECT_FALSE(security_info.displayed_private_user_data_input_on_http);
302 EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level); 303 EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level);
303 } 304 }
304 305
306 // Tests that SSL.MarkHttpAsStatus histogram is updated when security state is
307 // computed for a page containing a password field on HTTP.
308 TEST(SecurityStateModelTest, MarkHttpAsStatusHistogram) {
309 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
310 switches::kMarkHttpAs,
311 switches::kMarkHttpWithPasswordsOrCcWithChip);
312 TestSecurityStateModelClient client;
313 client.UseHttpUrl();
314 SecurityStateModel model;
315 model.SetClient(&client);
316 client.set_displayed_password_field_on_http(true);
317 SecurityStateModel::SecurityInfo security_info;
318
319 base::HistogramTester histograms;
320
estark 2016/10/26 19:53:27 nit: I'd suggest creating the HistogramTester at t
321 model.GetSecurityInfo(&security_info);
322
323 histograms.ExpectUniqueSample("SSL.MarkHttpAsStatus",
324 2/*HTTP_SHOW_WARNING*/, 1);
estark 2016/10/26 19:53:27 nit: whitespace should be: 2 /* HTTP_SHOW_WARNING
325 }
326
305 } // namespace 327 } // namespace
306 328
307 } // namespace security_state 329 } // namespace security_state
OLDNEW
« 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