| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cert/ct_objects_extractor.h" | 5 #include "net/cert/ct_objects_extractor.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "net/base/test_data_directory.h" | 8 #include "net/base/test_data_directory.h" |
| 9 #include "net/cert/ct_log_verifier.h" | 9 #include "net/cert/ct_log_verifier.h" |
| 10 #include "net/cert/ct_serialization.h" | 10 #include "net/cert/ct_serialization.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 scoped_refptr<const CTLogVerifier> log_; | 55 scoped_refptr<const CTLogVerifier> log_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // Test that an SCT can be extracted and the extracted SCT contains the | 58 // Test that an SCT can be extracted and the extracted SCT contains the |
| 59 // expected data. | 59 // expected data. |
| 60 TEST_F(CTObjectsExtractorTest, ExtractEmbeddedSCT) { | 60 TEST_F(CTObjectsExtractorTest, ExtractEmbeddedSCT) { |
| 61 scoped_refptr<ct::SignedCertificateTimestamp> sct( | 61 scoped_refptr<ct::SignedCertificateTimestamp> sct( |
| 62 new ct::SignedCertificateTimestamp()); | 62 new ct::SignedCertificateTimestamp()); |
| 63 ExtractEmbeddedSCT(precert_chain_[0], &sct); | 63 ExtractEmbeddedSCT(precert_chain_[0], &sct); |
| 64 | 64 |
| 65 EXPECT_EQ(sct->version, SignedCertificateTimestamp::SCT_VERSION_1); | 65 EXPECT_EQ(sct->version, SignedCertificateTimestamp::V1); |
| 66 EXPECT_EQ(ct::GetTestPublicKeyId(), sct->log_id); | 66 EXPECT_EQ(ct::GetTestPublicKeyId(), sct->log_id); |
| 67 | 67 |
| 68 base::Time expected_timestamp = | 68 base::Time expected_timestamp = |
| 69 base::Time::UnixEpoch() + | 69 base::Time::UnixEpoch() + |
| 70 base::TimeDelta::FromMilliseconds(1365181456275); | 70 base::TimeDelta::FromMilliseconds(1365181456275); |
| 71 EXPECT_EQ(expected_timestamp, sct->timestamp); | 71 EXPECT_EQ(expected_timestamp, sct->timestamp); |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST_F(CTObjectsExtractorTest, ExtractPrecert) { | 74 TEST_F(CTObjectsExtractorTest, ExtractPrecert) { |
| 75 LogEntry entry; | 75 LogEntry entry; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 std::string extracted_sct_list; | 173 std::string extracted_sct_list; |
| 174 // Use test_cert_ for issuer - it is not the correct issuer of |subject_cert|. | 174 // Use test_cert_ for issuer - it is not the correct issuer of |subject_cert|. |
| 175 EXPECT_FALSE(ct::ExtractSCTListFromOCSPResponse( | 175 EXPECT_FALSE(ct::ExtractSCTListFromOCSPResponse( |
| 176 test_cert_->os_cert_handle(), subject_cert->serial_number(), | 176 test_cert_->os_cert_handle(), subject_cert->serial_number(), |
| 177 ocsp_response, &extracted_sct_list)); | 177 ocsp_response, &extracted_sct_list)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace ct | 180 } // namespace ct |
| 181 | 181 |
| 182 } // namespace net | 182 } // namespace net |
| OLD | NEW |