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/cast_certificate/cast_cert_validator_test_helpers.h" | 5 #include "components/cast_certificate/cast_cert_validator_test_helpers.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "net/cert/internal/cert_errors.h" | 9 #include "net/cert/internal/cert_errors.h" |
10 #include "net/cert/pem_tokenizer.h" | 10 #include "net/cert/pem_tokenizer.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 const std::string& path) { | 86 const std::string& path) { |
87 std::unique_ptr<net::TrustStoreInMemory> trust_store( | 87 std::unique_ptr<net::TrustStoreInMemory> trust_store( |
88 new net::TrustStoreInMemory()); | 88 new net::TrustStoreInMemory()); |
89 const auto trusted_test_roots = | 89 const auto trusted_test_roots = |
90 cast_certificate::testing::ReadCertificateChainFromFile(path); | 90 cast_certificate::testing::ReadCertificateChainFromFile(path); |
91 for (const auto& trusted_root : trusted_test_roots) { | 91 for (const auto& trusted_root : trusted_test_roots) { |
92 net::CertErrors errors; | 92 net::CertErrors errors; |
93 scoped_refptr<net::ParsedCertificate> cert(net::ParsedCertificate::Create( | 93 scoped_refptr<net::ParsedCertificate> cert(net::ParsedCertificate::Create( |
94 net::x509_util::CreateCryptoBuffer(trusted_root), {}, &errors)); | 94 net::x509_util::CreateCryptoBuffer(trusted_root), {}, &errors)); |
95 EXPECT_TRUE(cert) << errors.ToDebugString(); | 95 EXPECT_TRUE(cert) << errors.ToDebugString(); |
96 scoped_refptr<net::TrustAnchor> anchor = | 96 trust_store->AddTrustAnchorWithConstraints(cert); |
ryanchung
2017/04/28 23:11:30
nit: std:move(cert) ?
eroman
2017/04/28 23:51:06
AddTrustAnchorWithConstraints() in this case takes
ryanchung
2017/04/28 23:57:37
Isn't it AddTrustAnchorWithConstraints(scoped_refp
| |
97 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert)); | |
98 trust_store->AddTrustAnchor(std::move(anchor)); | |
99 } | 97 } |
100 return trust_store; | 98 return trust_store; |
101 } | 99 } |
102 | 100 |
103 base::Time ConvertUnixTimestampSeconds(uint64_t time) { | 101 base::Time ConvertUnixTimestampSeconds(uint64_t time) { |
104 return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(time); | 102 return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(time); |
105 } | 103 } |
106 | 104 |
107 } // namespace testing | 105 } // namespace testing |
108 | 106 |
109 } // namespace cast_certificate | 107 } // namespace cast_certificate |
OLD | NEW |