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..47369b9909f86ad2a098ac4b973e3475ba9d288b 100644 |
--- a/components/cast_certificate/cast_cert_validator_test_helpers.cc |
+++ b/components/cast_certificate/cast_cert_validator_test_helpers.cc |
@@ -80,6 +80,27 @@ 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, {})); |
eroman
2016/09/17 00:44:41
You will need to sync -- this has been renamed to
ryanchung
2016/09/22 21:38:51
Done. Thanks.
|
+ 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::FromSeconds(time); |
+} |
+ |
} // namespace testing |
} // namespace cast_certificate |