| 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 "net/cert/internal/trust_store_collection.h" | 5 #include "net/cert/internal/trust_store_collection.h" |
| 6 | 6 |
| 7 #include "net/cert/internal/test_helpers.h" | 7 #include "net/cert/internal/test_helpers.h" |
| 8 #include "net/cert/internal/trust_store_in_memory.h" | 8 #include "net/cert/internal/trust_store_in_memory.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class TrustStoreCollectionTest : public testing::Test { | 15 class TrustStoreCollectionTest : public testing::Test { |
| 16 public: | 16 public: |
| 17 void SetUp() override { | 17 void SetUp() override { |
| 18 ParsedCertificateList chain; | 18 ParsedCertificateList chain; |
| 19 | 19 ASSERT_TRUE(ReadCertChainFromFile( |
| 20 VerifyCertChainTest test; | 20 "net/data/verify_certificate_chain_unittest/key-rollover/oldchain.pem", |
| 21 ReadVerifyCertChainTestFromFile( | 21 &chain)); |
| 22 "net/data/verify_certificate_chain_unittest/key-rollover-oldchain.pem", | |
| 23 &test); | |
| 24 chain = test.chain; | |
| 25 | 22 |
| 26 ASSERT_EQ(3U, chain.size()); | 23 ASSERT_EQ(3U, chain.size()); |
| 27 target_ = chain[0]; | 24 target_ = chain[0]; |
| 28 oldintermediate_ = chain[1]; | 25 oldintermediate_ = chain[1]; |
| 29 oldroot_ = chain[2]; | 26 oldroot_ = chain[2]; |
| 30 ASSERT_TRUE(target_); | 27 ASSERT_TRUE(target_); |
| 31 ASSERT_TRUE(oldintermediate_); | 28 ASSERT_TRUE(oldintermediate_); |
| 32 ASSERT_TRUE(oldroot_); | 29 ASSERT_TRUE(oldroot_); |
| 33 | 30 |
| 34 ReadVerifyCertChainTestFromFile( | 31 ASSERT_TRUE( |
| 35 "net/data/verify_certificate_chain_unittest/" | 32 ReadCertChainFromFile("net/data/verify_certificate_chain_unittest/" |
| 36 "key-rollover-longrolloverchain.pem", | 33 "key-rollover/longrolloverchain.pem", |
| 37 &test); | 34 &chain)); |
| 38 chain = test.chain; | |
| 39 | 35 |
| 40 ASSERT_EQ(5U, chain.size()); | 36 ASSERT_EQ(5U, chain.size()); |
| 41 newintermediate_ = chain[1]; | 37 newintermediate_ = chain[1]; |
| 42 newroot_ = chain[2]; | 38 newroot_ = chain[2]; |
| 43 newrootrollover_ = chain[3]; | 39 newrootrollover_ = chain[3]; |
| 44 ASSERT_TRUE(newintermediate_); | 40 ASSERT_TRUE(newintermediate_); |
| 45 ASSERT_TRUE(newroot_); | 41 ASSERT_TRUE(newroot_); |
| 46 ASSERT_TRUE(newrootrollover_); | 42 ASSERT_TRUE(newrootrollover_); |
| 47 } | 43 } |
| 48 | 44 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 EXPECT_EQ(CertificateTrustType::DISTRUSTED, trust.type); | 173 EXPECT_EQ(CertificateTrustType::DISTRUSTED, trust.type); |
| 178 | 174 |
| 179 // newrootrollover_ is unspecified. | 175 // newrootrollover_ is unspecified. |
| 180 collection.GetTrust(newrootrollover_, &trust); | 176 collection.GetTrust(newrootrollover_, &trust); |
| 181 EXPECT_EQ(CertificateTrustType::UNSPECIFIED, trust.type); | 177 EXPECT_EQ(CertificateTrustType::UNSPECIFIED, trust.type); |
| 182 } | 178 } |
| 183 | 179 |
| 184 } // namespace | 180 } // namespace |
| 185 | 181 |
| 186 } // namespace net | 182 } // namespace net |
| OLD | NEW |