| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 int64_t total_network_bytes_received() const { | 289 int64_t total_network_bytes_received() const { |
| 290 return total_network_bytes_received_; | 290 return total_network_bytes_received_; |
| 291 } | 291 } |
| 292 int64_t total_network_bytes_sent() const { return total_network_bytes_sent_; } | 292 int64_t total_network_bytes_sent() const { return total_network_bytes_sent_; } |
| 293 | 293 |
| 294 // Last observed proxy in proxy header sent callback. | 294 // Last observed proxy in proxy header sent callback. |
| 295 HostPortPair last_observed_proxy() { | 295 HostPortPair last_observed_proxy() { |
| 296 return last_observed_proxy_; | 296 return last_observed_proxy_; |
| 297 } | 297 } |
| 298 | 298 |
| 299 const HttpRequestHeaders& last_headers() const { return last_headers_; } |
| 300 |
| 299 void set_can_be_intercepted_on_error(bool can_be_intercepted_on_error) { | 301 void set_can_be_intercepted_on_error(bool can_be_intercepted_on_error) { |
| 300 will_be_intercepted_on_next_error_ = can_be_intercepted_on_error; | 302 will_be_intercepted_on_next_error_ = can_be_intercepted_on_error; |
| 301 } | 303 } |
| 302 | 304 |
| 303 protected: | 305 protected: |
| 304 // NetworkDelegate: | 306 // NetworkDelegate: |
| 305 int OnBeforeURLRequest(URLRequest* request, | 307 int OnBeforeURLRequest(URLRequest* request, |
| 306 const CompletionCallback& callback, | 308 const CompletionCallback& callback, |
| 307 GURL* new_url) override; | 309 GURL* new_url) override; |
| 308 int OnBeforeSendHeaders(URLRequest* request, | 310 int OnBeforeSendHeaders(URLRequest* request, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 LoadTimingInfo load_timing_info_before_redirect_; | 384 LoadTimingInfo load_timing_info_before_redirect_; |
| 383 bool has_load_timing_info_before_redirect_; | 385 bool has_load_timing_info_before_redirect_; |
| 384 | 386 |
| 385 LoadTimingInfo load_timing_info_before_auth_; | 387 LoadTimingInfo load_timing_info_before_auth_; |
| 386 bool has_load_timing_info_before_auth_; | 388 bool has_load_timing_info_before_auth_; |
| 387 | 389 |
| 388 bool can_access_files_; // true by default | 390 bool can_access_files_; // true by default |
| 389 bool experimental_cookie_features_enabled_; // false by default | 391 bool experimental_cookie_features_enabled_; // false by default |
| 390 bool cancel_request_with_policy_violating_referrer_; // false by default | 392 bool cancel_request_with_policy_violating_referrer_; // false by default |
| 391 bool will_be_intercepted_on_next_error_; | 393 bool will_be_intercepted_on_next_error_; |
| 394 |
| 395 HttpRequestHeaders last_headers_; |
| 392 }; | 396 }; |
| 393 | 397 |
| 394 //----------------------------------------------------------------------------- | 398 //----------------------------------------------------------------------------- |
| 395 | 399 |
| 396 // A simple ProtocolHandler that returns a pre-built URLRequestJob only once. | 400 // A simple ProtocolHandler that returns a pre-built URLRequestJob only once. |
| 397 class TestJobInterceptor : public URLRequestJobFactory::ProtocolHandler { | 401 class TestJobInterceptor : public URLRequestJobFactory::ProtocolHandler { |
| 398 public: | 402 public: |
| 399 TestJobInterceptor(); | 403 TestJobInterceptor(); |
| 400 | 404 |
| 401 URLRequestJob* MaybeCreateJob( | 405 URLRequestJob* MaybeCreateJob( |
| 402 URLRequest* request, | 406 URLRequest* request, |
| 403 NetworkDelegate* network_delegate) const override; | 407 NetworkDelegate* network_delegate) const override; |
| 404 void set_main_intercept_job(URLRequestJob* job); | 408 void set_main_intercept_job(URLRequestJob* job); |
| 405 | 409 |
| 406 private: | 410 private: |
| 407 mutable URLRequestJob* main_intercept_job_; | 411 mutable URLRequestJob* main_intercept_job_; |
| 408 }; | 412 }; |
| 409 | 413 |
| 410 } // namespace net | 414 } // namespace net |
| 411 | 415 |
| 412 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 416 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| OLD | NEW |