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

Side by Side Diff: components/certificate_transparency/single_tree_tracker_unittest.cc

Issue 2269383003: Certificate Transparency: Make DNS front-end required. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing the md file Created 4 years, 4 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
« no previous file with comments | « no previous file | net/cert/ct_log_verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/certificate_transparency/single_tree_tracker.h" 5 #include "components/certificate_transparency/single_tree_tracker.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 0x1a, 0x9f, 0x20, 0x79, 0xd0, 0xc1, 0x34, 0x2e, 0x08}; 48 0x1a, 0x9f, 0x20, 0x79, 0xd0, 0xc1, 0x34, 0x2e, 0x08};
49 base::StringPiece sp(reinterpret_cast<const char*>(kOldSTHSignatureData), 49 base::StringPiece sp(reinterpret_cast<const char*>(kOldSTHSignatureData),
50 sizeof(kOldSTHSignatureData)); 50 sizeof(kOldSTHSignatureData));
51 return DecodeDigitallySigned(&sp, &(sth->signature)) && sp.empty(); 51 return DecodeDigitallySigned(&sp, &(sth->signature)) && sp.empty();
52 } 52 }
53 53
54 } // namespace 54 } // namespace
55 55
56 class SingleTreeTrackerTest : public ::testing::Test { 56 class SingleTreeTrackerTest : public ::testing::Test {
57 void SetUp() override { 57 void SetUp() override {
58 log_ = net::CTLogVerifier::Create(net::ct::GetTestPublicKey(), "testlog", 58 log_ =
59 "https://ct.example.com", ""); 59 net::CTLogVerifier::Create(net::ct::GetTestPublicKey(), "testlog",
60 "https://ct.example.com", "dns.example.com");
60 61
61 ASSERT_TRUE(log_); 62 ASSERT_TRUE(log_);
62 ASSERT_EQ(log_->key_id(), net::ct::GetTestPublicKeyId()); 63 ASSERT_EQ(log_->key_id(), net::ct::GetTestPublicKeyId());
63 64
64 tree_tracker_.reset(new SingleTreeTracker(log_)); 65 tree_tracker_.reset(new SingleTreeTracker(log_));
65 const std::string der_test_cert(net::ct::GetDerEncodedX509Cert()); 66 const std::string der_test_cert(net::ct::GetDerEncodedX509Cert());
66 chain_ = net::X509Certificate::CreateFromBytes(der_test_cert.data(), 67 chain_ = net::X509Certificate::CreateFromBytes(der_test_cert.data(),
67 der_test_cert.length()); 68 der_test_cert.length());
68 ASSERT_TRUE(chain_.get()); 69 ASSERT_TRUE(chain_.get());
69 net::ct::GetX509CertSCT(&cert_sct_); 70 net::ct::GetX509CertSCT(&cert_sct_);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Notify of an SCT and make sure it's in the 'pending newer STH' state. 193 // Notify of an SCT and make sure it's in the 'pending newer STH' state.
193 tree_tracker_->OnSCTVerified(chain_.get(), cert_sct_.get()); 194 tree_tracker_->OnSCTVerified(chain_.get(), cert_sct_.get());
194 195
195 // Exactly one value should be logged, indicating the SCT cannot be checked 196 // Exactly one value should be logged, indicating the SCT cannot be checked
196 // for inclusion as the STH is too old. 197 // for inclusion as the STH is too old.
197 histograms.ExpectTotalCount(kCanCheckForInclusionHistogramName, 1); 198 histograms.ExpectTotalCount(kCanCheckForInclusionHistogramName, 1);
198 histograms.ExpectBucketCount(kCanCheckForInclusionHistogramName, 1, 1); 199 histograms.ExpectBucketCount(kCanCheckForInclusionHistogramName, 1, 1);
199 } 200 }
200 201
201 } // namespace certificate_transparency 202 } // namespace certificate_transparency
OLDNEW
« no previous file with comments | « no previous file | net/cert/ct_log_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698