OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_net/nss_ocsp.h" | 5 #include "net/cert_net/nss_ocsp.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
15 #include "net/base/test_completion_callback.h" | 16 #include "net/base/test_completion_callback.h" |
16 #include "net/base/test_data_directory.h" | 17 #include "net/base/test_data_directory.h" |
17 #include "net/cert/cert_status_flags.h" | 18 #include "net/cert/cert_status_flags.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 GetTestCertsDirectory().AppendASCII("aia-intermediate.der"), | 85 GetTestCertsDirectory().AppendASCII("aia-intermediate.der"), |
85 &file_contents)); | 86 &file_contents)); |
86 ASSERT_FALSE(file_contents.empty()); | 87 ASSERT_FALSE(file_contents.empty()); |
87 | 88 |
88 // Ownership of |handler| is transferred to the URLRequestFilter, but | 89 // Ownership of |handler| is transferred to the URLRequestFilter, but |
89 // hold onto the original pointer in order to access |request_count()|. | 90 // hold onto the original pointer in order to access |request_count()|. |
90 scoped_ptr<AiaResponseHandler> handler( | 91 scoped_ptr<AiaResponseHandler> handler( |
91 new AiaResponseHandler(kAiaHeaders, file_contents)); | 92 new AiaResponseHandler(kAiaHeaders, file_contents)); |
92 handler_ = handler.get(); | 93 handler_ = handler.get(); |
93 | 94 |
94 URLRequestFilter::GetInstance()->AddHostnameInterceptor( | 95 URLRequestFilter::GetInstance()->AddHostnameInterceptor("http", kAiaHost, |
95 "http", kAiaHost, handler.Pass()); | 96 std::move(handler)); |
96 | 97 |
97 SetURLRequestContextForNSSHttpIO(&context_); | 98 SetURLRequestContextForNSSHttpIO(&context_); |
98 EnsureNSSHttpIOInit(); | 99 EnsureNSSHttpIOInit(); |
99 } | 100 } |
100 | 101 |
101 void TearDown() override { | 102 void TearDown() override { |
102 ShutdownNSSHttpIO(); | 103 ShutdownNSSHttpIO(); |
103 | 104 |
104 if (handler_) | 105 if (handler_) |
105 URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kAiaHost); | 106 URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kAiaHost); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 150 |
150 error = test_callback.WaitForResult(); | 151 error = test_callback.WaitForResult(); |
151 | 152 |
152 EXPECT_EQ(OK, error); | 153 EXPECT_EQ(OK, error); |
153 | 154 |
154 // Ensure that NSS made an AIA request for the missing intermediate. | 155 // Ensure that NSS made an AIA request for the missing intermediate. |
155 EXPECT_LT(0, request_count()); | 156 EXPECT_LT(0, request_count()); |
156 } | 157 } |
157 | 158 |
158 } // namespace net | 159 } // namespace net |
OLD | NEW |