Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: net/ocsp/nss_ocsp_unittest.cc

Issue 686343002: Add MaybeInterceptRedirect/Response to URLRequestInterceptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests, removed DRP Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 class AiaResponseHandler : public net::URLRequestInterceptor { 43 class AiaResponseHandler : public net::URLRequestInterceptor {
44 public: 44 public:
45 AiaResponseHandler(const std::string& headers, const std::string& cert_data) 45 AiaResponseHandler(const std::string& headers, const std::string& cert_data)
46 : headers_(headers), cert_data_(cert_data), request_count_(0) {} 46 : headers_(headers), cert_data_(cert_data), request_count_(0) {}
47 ~AiaResponseHandler() override {} 47 ~AiaResponseHandler() override {}
48 48
49 // net::URLRequestInterceptor implementation: 49 // net::URLRequestInterceptor implementation:
50 net::URLRequestJob* MaybeInterceptRequest( 50 net::URLRequestJob* MaybeInterceptRequest(
51 net::URLRequest* request, 51 net::URLRequest* request,
52 net::NetworkDelegate* network_delegate) const override { 52 net::NetworkDelegate* network_delegate) override {
53 ++const_cast<AiaResponseHandler*>(this)->request_count_; 53 ++const_cast<AiaResponseHandler*>(this)->request_count_;
54 54
55 return new net::URLRequestTestJob( 55 return new net::URLRequestTestJob(
56 request, network_delegate, headers_, cert_data_, true); 56 request, network_delegate, headers_, cert_data_, true);
57 } 57 }
58 58
59 net::URLRequestJob* MaybeInterceptRedirect(
60 net::URLRequest* request,
61 net::NetworkDelegate* network_delegate,
62 const GURL& location) override {
63 return NULL;
64 }
65
66 net::URLRequestJob* MaybeInterceptResponse(
67 net::URLRequest* request,
68 net::NetworkDelegate* network_delegate) override {
69 return NULL;
70 }
71
59 int request_count() const { return request_count_; } 72 int request_count() const { return request_count_; }
60 73
61 private: 74 private:
62 std::string headers_; 75 std::string headers_;
63 std::string cert_data_; 76 std::string cert_data_;
64 int request_count_; 77 int request_count_;
65 78
66 DISALLOW_COPY_AND_ASSIGN(AiaResponseHandler); 79 DISALLOW_COPY_AND_ASSIGN(AiaResponseHandler);
67 }; 80 };
68 81
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 166
154 error = test_callback.WaitForResult(); 167 error = test_callback.WaitForResult();
155 168
156 EXPECT_EQ(OK, error); 169 EXPECT_EQ(OK, error);
157 170
158 // Ensure that NSS made an AIA request for the missing intermediate. 171 // Ensure that NSS made an AIA request for the missing intermediate.
159 EXPECT_LT(0, request_count()); 172 EXPECT_LT(0, request_count());
160 } 173 }
161 174
162 } // namespace net 175 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698