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/ocsp/nss_ocsp.h" | 5 #include "net/ocsp/nss_ocsp.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 &file_contents)); | 84 &file_contents)); |
85 ASSERT_FALSE(file_contents.empty()); | 85 ASSERT_FALSE(file_contents.empty()); |
86 | 86 |
87 // Ownership of |handler| is transferred to the URLRequestFilter, but | 87 // Ownership of |handler| is transferred to the URLRequestFilter, but |
88 // hold onto the original pointer in order to access |request_count()|. | 88 // hold onto the original pointer in order to access |request_count()|. |
89 scoped_ptr<AiaResponseHandler> handler( | 89 scoped_ptr<AiaResponseHandler> handler( |
90 new AiaResponseHandler(kAiaHeaders, file_contents)); | 90 new AiaResponseHandler(kAiaHeaders, file_contents)); |
91 handler_ = handler.get(); | 91 handler_ = handler.get(); |
92 | 92 |
93 URLRequestFilter::GetInstance()->AddHostnameInterceptor( | 93 URLRequestFilter::GetInstance()->AddHostnameInterceptor( |
94 "http", | 94 "http", kAiaHost, handler.Pass()); |
95 kAiaHost, | |
96 handler.PassAs<URLRequestInterceptor>()); | |
97 | 95 |
98 SetURLRequestContextForNSSHttpIO(&context_); | 96 SetURLRequestContextForNSSHttpIO(&context_); |
99 EnsureNSSHttpIOInit(); | 97 EnsureNSSHttpIOInit(); |
100 } | 98 } |
101 | 99 |
102 virtual void TearDown() { | 100 virtual void TearDown() { |
103 ShutdownNSSHttpIO(); | 101 ShutdownNSSHttpIO(); |
104 | 102 |
105 if (handler_) | 103 if (handler_) |
106 URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kAiaHost); | 104 URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kAiaHost); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 153 |
156 error = test_callback.WaitForResult(); | 154 error = test_callback.WaitForResult(); |
157 | 155 |
158 EXPECT_EQ(OK, error); | 156 EXPECT_EQ(OK, error); |
159 | 157 |
160 // Ensure that NSS made an AIA request for the missing intermediate. | 158 // Ensure that NSS made an AIA request for the missing intermediate. |
161 EXPECT_LT(0, request_count()); | 159 EXPECT_LT(0, request_count()); |
162 } | 160 } |
163 | 161 |
164 } // namespace net | 162 } // namespace net |
OLD | NEW |