| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_UNITTEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const int kFTPDefaultPort = 1338; | 36 const int kFTPDefaultPort = 1338; |
| 37 | 37 |
| 38 const std::string kDefaultHostName("localhost"); | 38 const std::string kDefaultHostName("localhost"); |
| 39 | 39 |
| 40 using base::TimeDelta; | 40 using base::TimeDelta; |
| 41 | 41 |
| 42 // This URLRequestContext does not use a local cache. | 42 // This URLRequestContext does not use a local cache. |
| 43 class TestURLRequestContext : public URLRequestContext { | 43 class TestURLRequestContext : public URLRequestContext { |
| 44 public: | 44 public: |
| 45 TestURLRequestContext() { | 45 TestURLRequestContext() { |
| 46 host_resolver_ = new net::HostResolver; | 46 host_resolver_ = net::CreateSystemHostResolver(); |
| 47 proxy_service_ = net::ProxyService::CreateNull(); | 47 proxy_service_ = net::ProxyService::CreateNull(); |
| 48 http_transaction_factory_ = | 48 http_transaction_factory_ = |
| 49 net::HttpNetworkLayer::CreateFactory(host_resolver_, | 49 net::HttpNetworkLayer::CreateFactory(host_resolver_, |
| 50 proxy_service_); | 50 proxy_service_); |
| 51 } | 51 } |
| 52 | 52 |
| 53 explicit TestURLRequestContext(const std::string& proxy) { | 53 explicit TestURLRequestContext(const std::string& proxy) { |
| 54 host_resolver_ = new net::HostResolver; | 54 host_resolver_ = net::CreateSystemHostResolver(); |
| 55 net::ProxyConfig proxy_config; | 55 net::ProxyConfig proxy_config; |
| 56 proxy_config.proxy_rules.ParseFromString(proxy); | 56 proxy_config.proxy_rules.ParseFromString(proxy); |
| 57 proxy_service_ = net::ProxyService::CreateFixed(proxy_config); | 57 proxy_service_ = net::ProxyService::CreateFixed(proxy_config); |
| 58 http_transaction_factory_ = | 58 http_transaction_factory_ = |
| 59 net::HttpNetworkLayer::CreateFactory(host_resolver_, | 59 net::HttpNetworkLayer::CreateFactory(host_resolver_, |
| 60 proxy_service_); | 60 proxy_service_); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual ~TestURLRequestContext() { | 63 virtual ~TestURLRequestContext() { |
| 64 delete http_transaction_factory_; | 64 delete http_transaction_factory_; |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 549 |
| 550 MessageLoop::current()->Run(); | 550 MessageLoop::current()->Run(); |
| 551 if (request.is_pending()) | 551 if (request.is_pending()) |
| 552 return false; | 552 return false; |
| 553 | 553 |
| 554 return true; | 554 return true; |
| 555 } | 555 } |
| 556 }; | 556 }; |
| 557 | 557 |
| 558 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 558 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| OLD | NEW |