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 #include "net/url_request/url_request_test_util.h" | 5 #include "net/url_request/url_request_test_util.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
11 #include "net/base/default_origin_bound_cert_store.h" | 11 #include "net/base/default_origin_bound_cert_store.h" |
12 #include "net/base/host_port_pair.h" | 12 #include "net/base/host_port_pair.h" |
| 13 #include "net/base/multi_threaded_cert_verifier.h" |
13 #include "net/base/origin_bound_cert_service.h" | 14 #include "net/base/origin_bound_cert_service.h" |
14 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
15 #include "net/http/http_server_properties_impl.h" | 16 #include "net/http/http_server_properties_impl.h" |
16 #include "net/url_request/url_request_job_factory.h" | 17 #include "net/url_request/url_request_job_factory.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // These constants put the net::NetworkDelegate events of TestNetworkDelegate | 21 // These constants put the net::NetworkDelegate events of TestNetworkDelegate |
21 // into an order. They are used in conjunction with | 22 // into an order. They are used in conjunction with |
22 // |TestNetworkDelegate::next_states_| to check that we do not send | 23 // |TestNetworkDelegate::next_states_| to check that we do not send |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 104 } |
104 | 105 |
105 TestURLRequestContext::~TestURLRequestContext() { | 106 TestURLRequestContext::~TestURLRequestContext() { |
106 DCHECK(initialized_); | 107 DCHECK(initialized_); |
107 } | 108 } |
108 | 109 |
109 void TestURLRequestContext::Init() { | 110 void TestURLRequestContext::Init() { |
110 DCHECK(!initialized_); | 111 DCHECK(!initialized_); |
111 initialized_ = true; | 112 initialized_ = true; |
112 if (!cert_verifier()) | 113 if (!cert_verifier()) |
113 context_storage_.set_cert_verifier(new net::CertVerifier); | 114 context_storage_.set_cert_verifier(new net::MultiThreadedCertVerifier); |
114 if (!ftp_transaction_factory()) { | 115 if (!ftp_transaction_factory()) { |
115 context_storage_.set_ftp_transaction_factory( | 116 context_storage_.set_ftp_transaction_factory( |
116 new net::FtpNetworkLayer(host_resolver())); | 117 new net::FtpNetworkLayer(host_resolver())); |
117 } | 118 } |
118 if (!ssl_config_service()) | 119 if (!ssl_config_service()) |
119 context_storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); | 120 context_storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); |
120 if (!http_auth_handler_factory()) { | 121 if (!http_auth_handler_factory()) { |
121 context_storage_.set_http_auth_handler_factory( | 122 context_storage_.set_http_auth_handler_factory( |
122 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); | 123 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); |
123 } | 124 } |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 518 |
518 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { | 519 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { |
519 DCHECK_EQ(value_, new_value_); | 520 DCHECK_EQ(value_, new_value_); |
520 value_ = old_value_; | 521 value_ = old_value_; |
521 } | 522 } |
522 | 523 |
523 // static | 524 // static |
524 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { | 525 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { |
525 return value_; | 526 return value_; |
526 } | 527 } |
OLD | NEW |