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

Side by Side Diff: net/http/transport_security_state_unittest.cc

Issue 2120683002: Fix up certificate error reporting histograms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: components/BUILD.gn fix, don't build unit tests on iOS Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/http/transport_security_state.h" 5 #include "net/http/transport_security_state.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 1380
1381 std::string failure_log; 1381 std::string failure_log;
1382 EXPECT_EQ(TransportSecurityState::PKPStatus::VIOLATED, 1382 EXPECT_EQ(TransportSecurityState::PKPStatus::VIOLATED,
1383 state.CheckPublicKeyPins( 1383 state.CheckPublicKeyPins(
1384 host_port_pair, true, bad_hashes, cert1.get(), cert2.get(), 1384 host_port_pair, true, bad_hashes, cert1.get(), cert2.get(),
1385 TransportSecurityState::ENABLE_PIN_REPORTS, &failure_log)); 1385 TransportSecurityState::ENABLE_PIN_REPORTS, &failure_log));
1386 1386
1387 // Check that the UMA histogram was updated when the report failed to 1387 // Check that the UMA histogram was updated when the report failed to
1388 // send. 1388 // send.
1389 histograms.ExpectTotalCount(histogram_name, 1); 1389 histograms.ExpectTotalCount(histogram_name, 1);
1390 histograms.ExpectBucketCount(histogram_name, mock_report_sender.net_error(), 1390 histograms.ExpectBucketCount(histogram_name, -mock_report_sender.net_error(),
1391 1); 1391 1);
1392 } 1392 }
1393 1393
1394 TEST_F(TransportSecurityStateTest, HPKPReportOnly) { 1394 TEST_F(TransportSecurityStateTest, HPKPReportOnly) {
1395 HostPortPair host_port_pair(kHost, kPort); 1395 HostPortPair host_port_pair(kHost, kPort);
1396 GURL report_uri(kReportUri); 1396 GURL report_uri(kReportUri);
1397 // Two dummy certs to use as the server-sent and validated chains. The 1397 // Two dummy certs to use as the server-sent and validated chains. The
1398 // contents don't matter. 1398 // contents don't matter.
1399 scoped_refptr<X509Certificate> cert1 = 1399 scoped_refptr<X509Certificate> cert1 =
1400 ImportCertFromFile(GetTestCertsDirectory(), "test_mail_google_com.pem"); 1400 ImportCertFromFile(GetTestCertsDirectory(), "test_mail_google_com.pem");
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 EXPECT_EQ(original_status, 1949 EXPECT_EQ(original_status,
1950 state.ShouldRequireCT("www.example.com", cert.get(), hashes)); 1950 state.ShouldRequireCT("www.example.com", cert.get(), hashes));
1951 1951
1952 state.SetRequireCTDelegate(nullptr); 1952 state.SetRequireCTDelegate(nullptr);
1953 EXPECT_EQ(original_status, 1953 EXPECT_EQ(original_status,
1954 state.ShouldRequireCT("www.example.com", cert.get(), hashes)); 1954 state.ShouldRequireCT("www.example.com", cert.get(), hashes));
1955 } 1955 }
1956 } 1956 }
1957 1957
1958 } // namespace net 1958 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698