| 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/cert_issuer_source_static.h" | 5 #include "net/cert/internal/cert_issuer_source_static.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "net/cert/internal/cert_errors.h" | 8 #include "net/cert/internal/cert_errors.h" |
| 9 #include "net/cert/internal/parsed_certificate.h" | 9 #include "net/cert/internal/parsed_certificate.h" |
| 10 #include "net/cert/internal/test_helpers.h" | 10 #include "net/cert/internal/test_helpers.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 void NotCalled(CertIssuerSource::Request* req) { | |
| 18 ADD_FAILURE() << "NotCalled was called"; | |
| 19 } | |
| 20 | |
| 21 ::testing::AssertionResult ReadTestPem(const std::string& file_name, | 17 ::testing::AssertionResult ReadTestPem(const std::string& file_name, |
| 22 const std::string& block_name, | 18 const std::string& block_name, |
| 23 std::string* result) { | 19 std::string* result) { |
| 24 const PemBlockMapping mappings[] = { | 20 const PemBlockMapping mappings[] = { |
| 25 {block_name.c_str(), result}, | 21 {block_name.c_str(), result}, |
| 26 }; | 22 }; |
| 27 | 23 |
| 28 return ReadTestDataFromPemFile(file_name, mappings); | 24 return ReadTestDataFromPemFile(file_name, mappings); |
| 29 } | 25 } |
| 30 | 26 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 126 |
| 131 ASSERT_EQ(1U, issuers.size()); | 127 ASSERT_EQ(1U, issuers.size()); |
| 132 EXPECT_TRUE(issuers[0] == root_); | 128 EXPECT_TRUE(issuers[0] == root_); |
| 133 } | 129 } |
| 134 | 130 |
| 135 // CertIssuerSourceStatic never returns results asynchronously. | 131 // CertIssuerSourceStatic never returns results asynchronously. |
| 136 TEST_F(CertIssuerSourceStaticTest, IsNotAsync) { | 132 TEST_F(CertIssuerSourceStaticTest, IsNotAsync) { |
| 137 CertIssuerSourceStatic source; | 133 CertIssuerSourceStatic source; |
| 138 source.AddCert(i1_1_); | 134 source.AddCert(i1_1_); |
| 139 std::unique_ptr<CertIssuerSource::Request> request; | 135 std::unique_ptr<CertIssuerSource::Request> request; |
| 140 source.AsyncGetIssuersOf(c1_.get(), base::Bind(&NotCalled), &request); | 136 source.AsyncGetIssuersOf(c1_.get(), &request); |
| 141 EXPECT_EQ(nullptr, request); | 137 EXPECT_EQ(nullptr, request); |
| 142 } | 138 } |
| 143 | 139 |
| 144 } // namespace | 140 } // namespace |
| 145 | 141 |
| 146 } // namespace net | 142 } // namespace net |
| OLD | NEW |