Chromium Code Reviews| Index: components/cast_certificate/cast_cert_validator_test_helpers.cc |
| diff --git a/components/cast_certificate/cast_cert_validator_test_helpers.cc b/components/cast_certificate/cast_cert_validator_test_helpers.cc |
| index a854abd8c185058a0ef64c4009b0872566d20a82..47fa4ad577e6142099c1f6ee6d00d014c23696c4 100644 |
| --- a/components/cast_certificate/cast_cert_validator_test_helpers.cc |
| +++ b/components/cast_certificate/cast_cert_validator_test_helpers.cc |
| @@ -80,6 +80,28 @@ SignatureTestData ReadSignatureTestData(const base::StringPiece& file_name) { |
| return result; |
| } |
| +std::unique_ptr<net::TrustStoreInMemory> CreateTrustStoreFromFile( |
| + const std::string& path) { |
| + std::unique_ptr<net::TrustStoreInMemory> trust_store( |
| + new net::TrustStoreInMemory()); |
| + const auto trusted_test_roots = |
| + cast_certificate::testing::ReadCertificateChainFromFile(path); |
| + for (const auto& trusted_root : trusted_test_roots) { |
| + scoped_refptr<net::ParsedCertificate> cert( |
| + net::ParsedCertificate::CreateFromCertificateCopy(trusted_root, {})); |
| + EXPECT_TRUE(cert); |
| + scoped_refptr<net::TrustAnchor> anchor = |
| + net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert)); |
| + trust_store->AddTrustAnchor(std::move(anchor)); |
| + } |
| + return trust_store; |
| +} |
| + |
| +base::Time ConvertUnixTimestampSeconds(uint64_t time) { |
| + return base::Time::UnixEpoch() + |
| + base::TimeDelta::FromMilliseconds(time * 1000); |
|
eroman
2016/09/10 01:03:23
Use FromSeconds().
(It also avoids doing the over
ryanchung
2016/09/14 18:53:39
Done.
|
| +} |
| + |
| } // namespace testing |
| } // namespace cast_certificate |