Chromium Code Reviews| 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/pem_tokenizer.h" | 9 #include "net/cert/pem_tokenizer.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 EXPECT_FALSE(result.message.empty()); | 76 EXPECT_FALSE(result.message.empty()); |
| 77 EXPECT_FALSE(result.signature_sha1.empty()); | 77 EXPECT_FALSE(result.signature_sha1.empty()); |
| 78 EXPECT_FALSE(result.signature_sha256.empty()); | 78 EXPECT_FALSE(result.signature_sha256.empty()); |
| 79 | 79 |
| 80 return result; | 80 return result; |
| 81 } | 81 } |
| 82 | 82 |
| 83 std::unique_ptr<net::TrustStoreInMemory> CreateTrustStoreFromFile( | |
| 84 const std::string& path) { | |
| 85 std::unique_ptr<net::TrustStoreInMemory> trust_store( | |
| 86 new net::TrustStoreInMemory()); | |
| 87 const auto trusted_test_roots = | |
| 88 cast_certificate::testing::ReadCertificateChainFromFile(path); | |
| 89 for (const auto& trusted_root : trusted_test_roots) { | |
| 90 scoped_refptr<net::ParsedCertificate> cert( | |
| 91 net::ParsedCertificate::CreateFromCertificateCopy(trusted_root, {})); | |
| 92 EXPECT_TRUE(cert); | |
| 93 scoped_refptr<net::TrustAnchor> anchor = | |
| 94 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert)); | |
| 95 trust_store->AddTrustAnchor(std::move(anchor)); | |
| 96 } | |
| 97 return trust_store; | |
| 98 } | |
| 99 | |
| 100 base::Time ConvertUnixTimestampSeconds(uint64_t time) { | |
| 101 return base::Time::UnixEpoch() + | |
| 102 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.
| |
| 103 } | |
| 104 | |
| 83 } // namespace testing | 105 } // namespace testing |
| 84 | 106 |
| 85 } // namespace cast_certificate | 107 } // namespace cast_certificate |
| OLD | NEW |