| 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 "base/threading/worker_pool.h" | 11 #include "base/threading/worker_pool.h" |
| 12 #include "net/base/cert_verifier.h" | 12 #include "net/base/cert_verifier.h" |
| 13 #include "net/base/default_server_bound_cert_store.h" | 13 #include "net/base/default_server_bound_cert_store.h" |
| 14 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
| 15 #include "net/base/mock_host_resolver.h" | 15 #include "net/base/mock_host_resolver.h" |
| 16 #include "net/base/server_bound_cert_service.h" | 16 #include "net/base/server_bound_cert_service.h" |
| 17 #include "net/http/http_network_session.h" | 17 #include "net/http/http_network_session.h" |
| 18 #include "net/http/http_server_properties_impl.h" | 18 #include "net/http/http_server_properties_impl.h" |
| 19 #include "net/url_request/url_request_job_factory.h" | 19 #include "net/url_request/url_request_job_factory_impl.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // These constants put the net::NetworkDelegate events of TestNetworkDelegate | 24 // These constants put the net::NetworkDelegate events of TestNetworkDelegate |
| 25 // into an order. They are used in conjunction with | 25 // into an order. They are used in conjunction with |
| 26 // |TestNetworkDelegate::next_states_| to check that we do not send | 26 // |TestNetworkDelegate::next_states_| to check that we do not send |
| 27 // events in the wrong order. | 27 // events in the wrong order. |
| 28 const int kStageBeforeURLRequest = 1 << 0; | 28 const int kStageBeforeURLRequest = 1 << 0; |
| 29 const int kStageBeforeSendHeaders = 1 << 1; | 29 const int kStageBeforeSendHeaders = 1 << 1; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 context_storage_.set_server_bound_cert_service( | 102 context_storage_.set_server_bound_cert_service( |
| 103 new net::ServerBoundCertService( | 103 new net::ServerBoundCertService( |
| 104 new net::DefaultServerBoundCertStore(NULL), | 104 new net::DefaultServerBoundCertStore(NULL), |
| 105 base::WorkerPool::GetTaskRunner(true))); | 105 base::WorkerPool::GetTaskRunner(true))); |
| 106 } | 106 } |
| 107 if (accept_language().empty()) | 107 if (accept_language().empty()) |
| 108 set_accept_language("en-us,fr"); | 108 set_accept_language("en-us,fr"); |
| 109 if (accept_charset().empty()) | 109 if (accept_charset().empty()) |
| 110 set_accept_charset("iso-8859-1,*,utf-8"); | 110 set_accept_charset("iso-8859-1,*,utf-8"); |
| 111 if (!job_factory()) | 111 if (!job_factory()) |
| 112 context_storage_.set_job_factory(new net::URLRequestJobFactory); | 112 context_storage_.set_job_factory(new net::URLRequestJobFactoryImpl); |
| 113 } | 113 } |
| 114 | 114 |
| 115 TestURLRequest::TestURLRequest(const GURL& url, | 115 TestURLRequest::TestURLRequest(const GURL& url, |
| 116 Delegate* delegate, | 116 Delegate* delegate, |
| 117 TestURLRequestContext* context) | 117 TestURLRequestContext* context) |
| 118 : net::URLRequest(url, delegate, context) { | 118 : net::URLRequest(url, delegate, context) { |
| 119 } | 119 } |
| 120 | 120 |
| 121 TestURLRequest::~TestURLRequest() { | 121 TestURLRequest::~TestURLRequest() { |
| 122 } | 122 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 517 |
| 518 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { | 518 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { |
| 519 DCHECK_EQ(value_, new_value_); | 519 DCHECK_EQ(value_, new_value_); |
| 520 value_ = old_value_; | 520 value_ = old_value_; |
| 521 } | 521 } |
| 522 | 522 |
| 523 // static | 523 // static |
| 524 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { | 524 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { |
| 525 return value_; | 525 return value_; |
| 526 } | 526 } |
| OLD | NEW |