| OLD | NEW | 
|---|
| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 45   base::StringPiece sp(reinterpret_cast<const char*>(kOldSTHSignatureData), | 45   base::StringPiece sp(reinterpret_cast<const char*>(kOldSTHSignatureData), | 
| 46                        sizeof(kOldSTHSignatureData)); | 46                        sizeof(kOldSTHSignatureData)); | 
| 47   return DecodeDigitallySigned(&sp, &(sth->signature)) && sp.empty(); | 47   return DecodeDigitallySigned(&sp, &(sth->signature)) && sp.empty(); | 
| 48 } | 48 } | 
| 49 | 49 | 
| 50 }  // namespace | 50 }  // namespace | 
| 51 | 51 | 
| 52 class SingleTreeTrackerTest : public ::testing::Test { | 52 class SingleTreeTrackerTest : public ::testing::Test { | 
| 53   void SetUp() override { | 53   void SetUp() override { | 
| 54     log_ = net::CTLogVerifier::Create(net::ct::GetTestPublicKey(), "testlog", | 54     log_ = net::CTLogVerifier::Create(net::ct::GetTestPublicKey(), "testlog", | 
| 55                                       "https://ct.example.com"); | 55                                       "https://ct.example.com", ""); | 
| 56 | 56 | 
| 57     ASSERT_TRUE(log_); | 57     ASSERT_TRUE(log_); | 
| 58     ASSERT_EQ(log_->key_id(), net::ct::GetTestPublicKeyId()); | 58     ASSERT_EQ(log_->key_id(), net::ct::GetTestPublicKeyId()); | 
| 59 | 59 | 
| 60     tree_tracker_.reset(new SingleTreeTracker(log_)); | 60     tree_tracker_.reset(new SingleTreeTracker(log_)); | 
| 61     const std::string der_test_cert(net::ct::GetDerEncodedX509Cert()); | 61     const std::string der_test_cert(net::ct::GetDerEncodedX509Cert()); | 
| 62     chain_ = net::X509Certificate::CreateFromBytes(der_test_cert.data(), | 62     chain_ = net::X509Certificate::CreateFromBytes(der_test_cert.data(), | 
| 63                                                    der_test_cert.length()); | 63                                                    der_test_cert.length()); | 
| 64     ASSERT_TRUE(chain_.get()); | 64     ASSERT_TRUE(chain_.get()); | 
| 65     net::ct::GetX509CertSCT(&cert_sct_); | 65     net::ct::GetX509CertSCT(&cert_sct_); | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 149   GetOldSignedTreeHead(&sth); | 149   GetOldSignedTreeHead(&sth); | 
| 150   tree_tracker_->NewSTHObserved(sth); | 150   tree_tracker_->NewSTHObserved(sth); | 
| 151 | 151 | 
| 152   // Make sure the SCT's state hasn't changed. | 152   // Make sure the SCT's state hasn't changed. | 
| 153   EXPECT_EQ( | 153   EXPECT_EQ( | 
| 154       SingleTreeTracker::SCT_PENDING_NEWER_STH, | 154       SingleTreeTracker::SCT_PENDING_NEWER_STH, | 
| 155       tree_tracker_->GetLogEntryInclusionStatus(chain_.get(), cert_sct_.get())); | 155       tree_tracker_->GetLogEntryInclusionStatus(chain_.get(), cert_sct_.get())); | 
| 156 } | 156 } | 
| 157 | 157 | 
| 158 }  // namespace certificate_transparency | 158 }  // namespace certificate_transparency | 
| OLD | NEW | 
|---|