| 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_nss.h" | 5 #include "net/cert/internal/trust_store_nss.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <certdb.h> | 8 #include <certdb.h> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "crypto/scoped_test_nss_db.h" | 12 #include "crypto/scoped_test_nss_db.h" |
| 13 #include "net/cert/internal/cert_issuer_source_sync_unittest.h" | 13 #include "net/cert/internal/cert_issuer_source_sync_unittest.h" |
| 14 #include "net/cert/internal/test_helpers.h" | 14 #include "net/cert/internal/test_helpers.h" |
| 15 #include "net/cert/scoped_nss_types.h" | 15 #include "net/cert/scoped_nss_types.h" |
| 16 #include "net/cert/x509_certificate.h" | 16 #include "net/cert/x509_certificate.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class TrustStoreNSSTest : public testing::Test { | 23 class TrustStoreNSSTest : public testing::Test { |
| 24 public: | 24 public: |
| 25 void SetUp() override { | 25 void SetUp() override { |
| 26 ASSERT_TRUE(test_nssdb_.is_open()); | 26 ASSERT_TRUE(test_nssdb_.is_open()); |
| 27 | |
| 28 VerifyCertChainTest test; | |
| 29 ParsedCertificateList chain; | 27 ParsedCertificateList chain; |
| 30 ReadVerifyCertChainTestFromFile( | 28 ReadCertChainFromFile( |
| 31 "net/data/verify_certificate_chain_unittest/key-rollover-oldchain.pem", | 29 "net/data/verify_certificate_chain_unittest/key-rollover/oldchain.pem", |
| 32 &test); | 30 &chain); |
| 33 chain = test.chain; | |
| 34 | 31 |
| 35 ASSERT_EQ(3U, chain.size()); | 32 ASSERT_EQ(3U, chain.size()); |
| 36 target_ = chain[0]; | 33 target_ = chain[0]; |
| 37 oldintermediate_ = chain[1]; | 34 oldintermediate_ = chain[1]; |
| 38 oldroot_ = chain[2]; | 35 oldroot_ = chain[2]; |
| 39 ASSERT_TRUE(target_); | 36 ASSERT_TRUE(target_); |
| 40 ASSERT_TRUE(oldintermediate_); | 37 ASSERT_TRUE(oldintermediate_); |
| 41 ASSERT_TRUE(oldroot_); | 38 ASSERT_TRUE(oldroot_); |
| 42 | 39 |
| 43 ReadVerifyCertChainTestFromFile( | 40 ReadCertChainFromFile( |
| 44 "net/data/verify_certificate_chain_unittest/" | 41 "net/data/verify_certificate_chain_unittest/" |
| 45 "key-rollover-longrolloverchain.pem", | 42 "key-rollover/longrolloverchain.pem", |
| 46 &test); | 43 &chain); |
| 47 chain = test.chain; | |
| 48 | 44 |
| 49 ASSERT_EQ(5U, chain.size()); | 45 ASSERT_EQ(5U, chain.size()); |
| 50 newintermediate_ = chain[1]; | 46 newintermediate_ = chain[1]; |
| 51 newroot_ = chain[2]; | 47 newroot_ = chain[2]; |
| 52 newrootrollover_ = chain[3]; | 48 newrootrollover_ = chain[3]; |
| 53 ASSERT_TRUE(newintermediate_); | 49 ASSERT_TRUE(newintermediate_); |
| 54 ASSERT_TRUE(newroot_); | 50 ASSERT_TRUE(newroot_); |
| 55 ASSERT_TRUE(newrootrollover_); | 51 ASSERT_TRUE(newrootrollover_); |
| 56 | 52 |
| 57 trust_store_nss_.reset(new TrustStoreNSS(trustSSL)); | 53 trust_store_nss_.reset(new TrustStoreNSS(trustSSL)); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 277 |
| 282 // NSS doesn't normalize UTF8String values, so use the not-normalized version of | 278 // NSS doesn't normalize UTF8String values, so use the not-normalized version of |
| 283 // those tests. | 279 // those tests. |
| 284 INSTANTIATE_TYPED_TEST_CASE_P(TrustStoreNSSNotNormalizedTest, | 280 INSTANTIATE_TYPED_TEST_CASE_P(TrustStoreNSSNotNormalizedTest, |
| 285 CertIssuerSourceSyncNotNormalizedTest, | 281 CertIssuerSourceSyncNotNormalizedTest, |
| 286 TrustStoreNSSTestDelegate); | 282 TrustStoreNSSTestDelegate); |
| 287 | 283 |
| 288 } // namespace | 284 } // namespace |
| 289 | 285 |
| 290 } // namespace net | 286 } // namespace net |
| OLD | NEW |