| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 void set_http_network_session_params( | 79 void set_http_network_session_params( |
| 80 std::unique_ptr<HttpNetworkSession::Params> params) { | 80 std::unique_ptr<HttpNetworkSession::Params> params) { |
| 81 http_network_session_params_ = std::move(params); | 81 http_network_session_params_ = std::move(params); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void SetSdchManager(std::unique_ptr<SdchManager> sdch_manager) { | 84 void SetSdchManager(std::unique_ptr<SdchManager> sdch_manager) { |
| 85 context_storage_.set_sdch_manager(std::move(sdch_manager)); | 85 context_storage_.set_sdch_manager(std::move(sdch_manager)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 CTPolicyEnforcer* ct_policy_enforcer() { return ct_policy_enforcer_; } | 88 void SetCTPolicyEnforcer( |
| 89 void set_ct_policy_enforcer(CTPolicyEnforcer* ct_policy_enforcer) { | 89 std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer) { |
| 90 ct_policy_enforcer_ = ct_policy_enforcer; | 90 context_storage_.set_ct_policy_enforcer(std::move(ct_policy_enforcer)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 bool initialized_; | 94 bool initialized_ = false; |
| 95 | 95 |
| 96 // Optional parameters to override default values. Note that values that | 96 // Optional parameters to override default values. Note that values that |
| 97 // point to other objects the TestURLRequestContext creates will be | 97 // point to other objects the TestURLRequestContext creates will be |
| 98 // overwritten. | 98 // overwritten. |
| 99 std::unique_ptr<HttpNetworkSession::Params> http_network_session_params_; | 99 std::unique_ptr<HttpNetworkSession::Params> http_network_session_params_; |
| 100 | 100 |
| 101 // Not owned: | 101 // Not owned: |
| 102 ClientSocketFactory* client_socket_factory_; | 102 ClientSocketFactory* client_socket_factory_ = nullptr; |
| 103 | 103 |
| 104 ProxyDelegate* proxy_delegate_; | 104 ProxyDelegate* proxy_delegate_ = nullptr; |
| 105 | |
| 106 CTPolicyEnforcer* ct_policy_enforcer_; | |
| 107 | 105 |
| 108 protected: | 106 protected: |
| 109 URLRequestContextStorage context_storage_; | 107 URLRequestContextStorage context_storage_; |
| 110 }; | 108 }; |
| 111 | 109 |
| 112 //----------------------------------------------------------------------------- | 110 //----------------------------------------------------------------------------- |
| 113 | 111 |
| 114 // Used to return a dummy context, which lives on the message loop | 112 // Used to return a dummy context, which lives on the message loop |
| 115 // given in the constructor. | 113 // given in the constructor. |
| 116 class TestURLRequestContextGetter : public URLRequestContextGetter { | 114 class TestURLRequestContextGetter : public URLRequestContextGetter { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 NetworkDelegate* network_delegate) const override; | 422 NetworkDelegate* network_delegate) const override; |
| 425 void set_main_intercept_job(std::unique_ptr<URLRequestJob> job); | 423 void set_main_intercept_job(std::unique_ptr<URLRequestJob> job); |
| 426 | 424 |
| 427 private: | 425 private: |
| 428 mutable std::unique_ptr<URLRequestJob> main_intercept_job_; | 426 mutable std::unique_ptr<URLRequestJob> main_intercept_job_; |
| 429 }; | 427 }; |
| 430 | 428 |
| 431 } // namespace net | 429 } // namespace net |
| 432 | 430 |
| 433 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 431 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| OLD | NEW |