| 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 #include <map> | 10 #include <map> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 void Init(); | 63 void Init(); |
| 64 | 64 |
| 65 ClientSocketFactory* client_socket_factory() { | 65 ClientSocketFactory* client_socket_factory() { |
| 66 return client_socket_factory_; | 66 return client_socket_factory_; |
| 67 } | 67 } |
| 68 void set_client_socket_factory(ClientSocketFactory* factory) { | 68 void set_client_socket_factory(ClientSocketFactory* factory) { |
| 69 client_socket_factory_ = factory; | 69 client_socket_factory_ = factory; |
| 70 } | 70 } |
| 71 | 71 |
| 72 ProxyDelegate* proxy_delegate() { return proxy_delegate_; } |
| 73 |
| 74 void set_proxy_delegate(ProxyDelegate* proxy_delegate) { |
| 75 proxy_delegate_ = proxy_delegate; |
| 76 } |
| 77 |
| 72 void set_http_network_session_params( | 78 void set_http_network_session_params( |
| 73 scoped_ptr<HttpNetworkSession::Params> params) { | 79 scoped_ptr<HttpNetworkSession::Params> params) { |
| 74 http_network_session_params_ = std::move(params); | 80 http_network_session_params_ = std::move(params); |
| 75 } | 81 } |
| 76 | 82 |
| 77 void SetSdchManager(scoped_ptr<SdchManager> sdch_manager) { | 83 void SetSdchManager(scoped_ptr<SdchManager> sdch_manager) { |
| 78 context_storage_.set_sdch_manager(std::move(sdch_manager)); | 84 context_storage_.set_sdch_manager(std::move(sdch_manager)); |
| 79 } | 85 } |
| 80 | 86 |
| 81 private: | 87 private: |
| 82 bool initialized_; | 88 bool initialized_; |
| 83 | 89 |
| 84 // Optional parameters to override default values. Note that values that | 90 // Optional parameters to override default values. Note that values that |
| 85 // point to other objects the TestURLRequestContext creates will be | 91 // point to other objects the TestURLRequestContext creates will be |
| 86 // overwritten. | 92 // overwritten. |
| 87 scoped_ptr<HttpNetworkSession::Params> http_network_session_params_; | 93 scoped_ptr<HttpNetworkSession::Params> http_network_session_params_; |
| 88 | 94 |
| 89 // Not owned: | 95 // Not owned: |
| 90 ClientSocketFactory* client_socket_factory_; | 96 ClientSocketFactory* client_socket_factory_; |
| 91 | 97 |
| 98 ProxyDelegate* proxy_delegate_; |
| 99 |
| 92 protected: | 100 protected: |
| 93 URLRequestContextStorage context_storage_; | 101 URLRequestContextStorage context_storage_; |
| 94 }; | 102 }; |
| 95 | 103 |
| 96 //----------------------------------------------------------------------------- | 104 //----------------------------------------------------------------------------- |
| 97 | 105 |
| 98 // Used to return a dummy context, which lives on the message loop | 106 // Used to return a dummy context, which lives on the message loop |
| 99 // given in the constructor. | 107 // given in the constructor. |
| 100 class TestURLRequestContextGetter : public URLRequestContextGetter { | 108 class TestURLRequestContextGetter : public URLRequestContextGetter { |
| 101 public: | 109 public: |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 NetworkDelegate* network_delegate) const override; | 412 NetworkDelegate* network_delegate) const override; |
| 405 void set_main_intercept_job(scoped_ptr<URLRequestJob> job); | 413 void set_main_intercept_job(scoped_ptr<URLRequestJob> job); |
| 406 | 414 |
| 407 private: | 415 private: |
| 408 mutable scoped_ptr<URLRequestJob> main_intercept_job_; | 416 mutable scoped_ptr<URLRequestJob> main_intercept_job_; |
| 409 }; | 417 }; |
| 410 | 418 |
| 411 } // namespace net | 419 } // namespace net |
| 412 | 420 |
| 413 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 421 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| OLD | NEW |