| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 11 #include "base/threading/worker_pool.h" | 11 #include "base/threading/worker_pool.h" |
| 12 #include "net/base/host_port_pair.h" | 12 #include "net/base/host_port_pair.h" |
| 13 #include "net/cert/cert_verifier.h" | 13 #include "net/cert/cert_verifier.h" |
| 14 #include "net/dns/mock_host_resolver.h" | 14 #include "net/dns/mock_host_resolver.h" |
| 15 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
| 16 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
| 17 #include "net/http/http_server_properties_impl.h" | 17 #include "net/http/http_server_properties_impl.h" |
| 18 #include "net/http/transport_security_state.h" | 18 #include "net/http/transport_security_state.h" |
| 19 #include "net/ssl/default_server_bound_cert_store.h" | 19 #include "net/ssl/channel_id_service.h" |
| 20 #include "net/ssl/server_bound_cert_service.h" | 20 #include "net/ssl/default_channel_id_store.h" |
| 21 #include "net/url_request/static_http_user_agent_settings.h" | 21 #include "net/url_request/static_http_user_agent_settings.h" |
| 22 #include "net/url_request/url_request_job_factory_impl.h" | 22 #include "net/url_request/url_request_job_factory_impl.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // These constants put the NetworkDelegate events of TestNetworkDelegate | 29 // These constants put the NetworkDelegate events of TestNetworkDelegate |
| 30 // into an order. They are used in conjunction with | 30 // into an order. They are used in conjunction with |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 params.http_server_properties = http_server_properties(); | 108 params.http_server_properties = http_server_properties(); |
| 109 params.net_log = net_log(); | 109 params.net_log = net_log(); |
| 110 context_storage_.set_http_transaction_factory(new HttpCache( | 110 context_storage_.set_http_transaction_factory(new HttpCache( |
| 111 new HttpNetworkSession(params), | 111 new HttpNetworkSession(params), |
| 112 HttpCache::DefaultBackend::InMemory(0))); | 112 HttpCache::DefaultBackend::InMemory(0))); |
| 113 } | 113 } |
| 114 // In-memory cookie store. | 114 // In-memory cookie store. |
| 115 if (!cookie_store()) | 115 if (!cookie_store()) |
| 116 context_storage_.set_cookie_store(new CookieMonster(NULL, NULL)); | 116 context_storage_.set_cookie_store(new CookieMonster(NULL, NULL)); |
| 117 // In-memory origin bound cert service. | 117 // In-memory origin bound cert service. |
| 118 if (!server_bound_cert_service()) { | 118 if (!channel_id_service()) { |
| 119 context_storage_.set_server_bound_cert_service( | 119 context_storage_.set_channel_id_service( |
| 120 new ServerBoundCertService( | 120 new ChannelIDService( |
| 121 new DefaultServerBoundCertStore(NULL), | 121 new DefaultChannelIDStore(NULL), |
| 122 base::WorkerPool::GetTaskRunner(true))); | 122 base::WorkerPool::GetTaskRunner(true))); |
| 123 } | 123 } |
| 124 if (!http_user_agent_settings()) { | 124 if (!http_user_agent_settings()) { |
| 125 context_storage_.set_http_user_agent_settings( | 125 context_storage_.set_http_user_agent_settings( |
| 126 new StaticHttpUserAgentSettings("en-us,fr", std::string())); | 126 new StaticHttpUserAgentSettings("en-us,fr", std::string())); |
| 127 } | 127 } |
| 128 if (!job_factory()) | 128 if (!job_factory()) |
| 129 context_storage_.set_job_factory(new URLRequestJobFactoryImpl); | 129 context_storage_.set_job_factory(new URLRequestJobFactoryImpl); |
| 130 } | 130 } |
| 131 | 131 |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 URLRequestJob* job = main_intercept_job_; | 641 URLRequestJob* job = main_intercept_job_; |
| 642 main_intercept_job_ = NULL; | 642 main_intercept_job_ = NULL; |
| 643 return job; | 643 return job; |
| 644 } | 644 } |
| 645 | 645 |
| 646 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { | 646 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { |
| 647 main_intercept_job_ = job; | 647 main_intercept_job_ = job; |
| 648 } | 648 } |
| 649 | 649 |
| 650 } // namespace net | 650 } // namespace net |
| OLD | NEW |