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 20 matching lines...) Expand all Loading... |
31 #include "net/cookies/cookie_monster.h" | 31 #include "net/cookies/cookie_monster.h" |
32 #include "net/disk_cache/disk_cache.h" | 32 #include "net/disk_cache/disk_cache.h" |
33 #include "net/ftp/ftp_network_layer.h" | 33 #include "net/ftp/ftp_network_layer.h" |
34 #include "net/http/http_auth_handler_factory.h" | 34 #include "net/http/http_auth_handler_factory.h" |
35 #include "net/http/http_cache.h" | 35 #include "net/http/http_cache.h" |
36 #include "net/http/http_network_layer.h" | 36 #include "net/http/http_network_layer.h" |
37 #include "net/http/http_network_session.h" | 37 #include "net/http/http_network_session.h" |
38 #include "net/http/http_request_headers.h" | 38 #include "net/http/http_request_headers.h" |
39 #include "net/proxy/proxy_service.h" | 39 #include "net/proxy/proxy_service.h" |
40 #include "net/ssl/ssl_config_service_defaults.h" | 40 #include "net/ssl/ssl_config_service_defaults.h" |
| 41 #include "net/url_request/http_protocol_handler.h" |
41 #include "net/url_request/url_request.h" | 42 #include "net/url_request/url_request.h" |
42 #include "net/url_request/url_request_context.h" | 43 #include "net/url_request/url_request_context.h" |
43 #include "net/url_request/url_request_context_getter.h" | 44 #include "net/url_request/url_request_context_getter.h" |
44 #include "net/url_request/url_request_context_storage.h" | 45 #include "net/url_request/url_request_context_storage.h" |
45 #include "net/url_request/url_request_job_factory.h" | 46 #include "net/url_request/url_request_job_factory.h" |
46 #include "url/url_util.h" | 47 #include "url/url_util.h" |
47 | 48 |
48 using base::TimeDelta; | 49 using base::TimeDelta; |
49 | 50 |
50 namespace net { | 51 namespace net { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 bool has_load_timing_info_before_auth_; | 403 bool has_load_timing_info_before_auth_; |
403 | 404 |
404 bool can_access_files_; // true by default | 405 bool can_access_files_; // true by default |
405 bool experimental_cookie_features_enabled_; // false by default | 406 bool experimental_cookie_features_enabled_; // false by default |
406 bool cancel_request_with_policy_violating_referrer_; // false by default | 407 bool cancel_request_with_policy_violating_referrer_; // false by default |
407 bool will_be_intercepted_on_next_error_; | 408 bool will_be_intercepted_on_next_error_; |
408 }; | 409 }; |
409 | 410 |
410 //----------------------------------------------------------------------------- | 411 //----------------------------------------------------------------------------- |
411 | 412 |
412 // A simple ProtocolHandler that returns a pre-built URLRequestJob only once. | 413 // A simple ProtocolHandler that returns a pre-built URLRequestJob only once, |
| 414 // and falls back to a normal HttpProtocolHandler implementation if no pre-built |
| 415 // URLRequestJob is present. |
413 class TestJobInterceptor : public URLRequestJobFactory::ProtocolHandler { | 416 class TestJobInterceptor : public URLRequestJobFactory::ProtocolHandler { |
414 public: | 417 public: |
415 TestJobInterceptor(); | 418 TestJobInterceptor(); |
416 ~TestJobInterceptor() override; | 419 ~TestJobInterceptor() override; |
417 | 420 |
418 URLRequestJob* MaybeCreateJob( | 421 URLRequestJob* MaybeCreateJob( |
419 URLRequest* request, | 422 URLRequest* request, |
420 NetworkDelegate* network_delegate) const override; | 423 NetworkDelegate* network_delegate) const override; |
421 void set_main_intercept_job(std::unique_ptr<URLRequestJob> job); | 424 void set_main_intercept_job(std::unique_ptr<URLRequestJob> job); |
422 | 425 |
423 private: | 426 private: |
| 427 std::unique_ptr<HttpProtocolHandler> http_protocol_handler_; |
424 mutable std::unique_ptr<URLRequestJob> main_intercept_job_; | 428 mutable std::unique_ptr<URLRequestJob> main_intercept_job_; |
425 }; | 429 }; |
426 | 430 |
427 } // namespace net | 431 } // namespace net |
428 | 432 |
429 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 433 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
OLD | NEW |