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 "headless/public/util/testing/generic_url_request_mocks.h" | 5 #include "headless/public/util/testing/generic_url_request_mocks.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 class URLRequestJob; | 10 class URLRequestJob; |
11 } // namespace net | 11 } // namespace net |
12 | 12 |
13 namespace headless { | 13 namespace headless { |
14 | 14 |
15 // MockGenericURLRequestJobDelegate | 15 // MockGenericURLRequestJobDelegate |
16 MockGenericURLRequestJobDelegate::MockGenericURLRequestJobDelegate() | 16 MockGenericURLRequestJobDelegate::MockGenericURLRequestJobDelegate() |
17 : should_block_(false) {} | 17 : should_block_(false) {} |
18 MockGenericURLRequestJobDelegate::~MockGenericURLRequestJobDelegate() {} | 18 MockGenericURLRequestJobDelegate::~MockGenericURLRequestJobDelegate() {} |
19 | 19 |
20 bool MockGenericURLRequestJobDelegate::BlockOrRewriteRequest( | 20 bool MockGenericURLRequestJobDelegate::BlockOrRewriteRequest( |
21 const GURL& url, | 21 const GURL& url, |
| 22 const std::string& method, |
22 const std::string& referrer, | 23 const std::string& referrer, |
23 GenericURLRequestJob::RewriteCallback callback) { | 24 GenericURLRequestJob::RewriteCallback callback) { |
24 if (should_block_) | 25 if (should_block_) |
25 callback(GenericURLRequestJob::RewriteResult::kDeny, GURL()); | 26 callback(GenericURLRequestJob::RewriteResult::kDeny, GURL(), method); |
26 return should_block_; | 27 return should_block_; |
27 } | 28 } |
28 | 29 |
29 const GenericURLRequestJob::HttpResponse* | 30 const GenericURLRequestJob::HttpResponse* |
30 MockGenericURLRequestJobDelegate::MaybeMatchResource( | 31 MockGenericURLRequestJobDelegate::MaybeMatchResource( |
31 const GURL& url, | 32 const GURL& url, |
| 33 const std::string& method, |
32 const net::HttpRequestHeaders& request_headers) { | 34 const net::HttpRequestHeaders& request_headers) { |
33 return nullptr; | 35 return nullptr; |
34 } | 36 } |
35 | 37 |
36 void MockGenericURLRequestJobDelegate::OnResourceLoadComplete( | 38 void MockGenericURLRequestJobDelegate::OnResourceLoadComplete( |
37 const GURL& final_url, | 39 const GURL& final_url, |
38 const std::string& mime_type, | 40 const std::string& mime_type, |
39 int http_response_code) {} | 41 int http_response_code) {} |
40 | 42 |
41 // MockCookieStore | 43 // MockCookieStore |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 int bytes_read) {} | 163 int bytes_read) {} |
162 const std::string& MockURLRequestDelegate::response_data() const { | 164 const std::string& MockURLRequestDelegate::response_data() const { |
163 return response_data_; | 165 return response_data_; |
164 } | 166 } |
165 | 167 |
166 const net::IOBufferWithSize* MockURLRequestDelegate::metadata() const { | 168 const net::IOBufferWithSize* MockURLRequestDelegate::metadata() const { |
167 return nullptr; | 169 return nullptr; |
168 } | 170 } |
169 | 171 |
170 } // namespace headless | 172 } // namespace headless |
OLD | NEW |