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_aia.h" | 5 #include "net/cert/internal/cert_issuer_source_aia.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "net/cert/cert_net_fetcher.h" | 8 #include "net/cert/cert_net_fetcher.h" |
| 9 #include "net/cert/internal/cert_errors.h" |
9 #include "net/cert/internal/parsed_certificate.h" | 10 #include "net/cert/internal/parsed_certificate.h" |
10 #include "net/cert/internal/test_helpers.h" | 11 #include "net/cert/internal/test_helpers.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
(...skipping 12 matching lines...) Expand all Loading... |
31 | 32 |
32 ::testing::AssertionResult ReadTestCert( | 33 ::testing::AssertionResult ReadTestCert( |
33 const std::string& file_name, | 34 const std::string& file_name, |
34 scoped_refptr<ParsedCertificate>* result) { | 35 scoped_refptr<ParsedCertificate>* result) { |
35 std::string der; | 36 std::string der; |
36 ::testing::AssertionResult r = | 37 ::testing::AssertionResult r = |
37 ReadTestPem("net/data/cert_issuer_source_aia_unittest/" + file_name, | 38 ReadTestPem("net/data/cert_issuer_source_aia_unittest/" + file_name, |
38 "CERTIFICATE", &der); | 39 "CERTIFICATE", &der); |
39 if (!r) | 40 if (!r) |
40 return r; | 41 return r; |
41 *result = ParsedCertificate::CreateFromCertificateCopy(der, {}); | 42 CertErrors errors; |
42 if (!*result) | 43 *result = ParsedCertificate::Create(der, {}, &errors); |
43 return ::testing::AssertionFailure() << "CreateFromCertificateCopy failed"; | 44 if (!*result) { |
| 45 return ::testing::AssertionFailure() |
| 46 << "ParsedCertificate::Create() failed:\n" |
| 47 << errors.ToDebugString(); |
| 48 } |
44 return ::testing::AssertionSuccess(); | 49 return ::testing::AssertionSuccess(); |
45 } | 50 } |
46 | 51 |
47 std::vector<uint8_t> CertDataVector(const ParsedCertificate* cert) { | 52 std::vector<uint8_t> CertDataVector(const ParsedCertificate* cert) { |
48 std::vector<uint8_t> data( | 53 std::vector<uint8_t> data( |
49 cert->der_cert().UnsafeData(), | 54 cert->der_cert().UnsafeData(), |
50 cert->der_cert().UnsafeData() + cert->der_cert().Length()); | 55 cert->der_cert().UnsafeData() + cert->der_cert().Length()); |
51 return data; | 56 return data; |
52 } | 57 } |
53 | 58 |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 EXPECT_TRUE(req_manager5->is_request_alive()); | 916 EXPECT_TRUE(req_manager5->is_request_alive()); |
912 | 917 |
913 // Sixth URL should not have created a request. | 918 // Sixth URL should not have created a request. |
914 EXPECT_FALSE( | 919 EXPECT_FALSE( |
915 mock_fetcher.GetRequestManagerForURL(GURL("http://url-for-aia6/I6.foo"))); | 920 mock_fetcher.GetRequestManagerForURL(GURL("http://url-for-aia6/I6.foo"))); |
916 } | 921 } |
917 | 922 |
918 } // namespace | 923 } // namespace |
919 | 924 |
920 } // namespace net | 925 } // namespace net |
OLD | NEW |