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 // TODO(eroman): we turn off host caching to see if synchronous |
| 47 // host resolving interacts poorly with client socket pool. [experiment] |
| 48 // http://crbug.com/13952 |
| 49 host_resolver_ = new net::HostResolver(0, 0); |
47 proxy_service_ = net::ProxyService::CreateNull(); | 50 proxy_service_ = net::ProxyService::CreateNull(); |
48 http_transaction_factory_ = | 51 http_transaction_factory_ = |
49 net::HttpNetworkLayer::CreateFactory(host_resolver_, | 52 net::HttpNetworkLayer::CreateFactory(host_resolver_, |
50 proxy_service_); | 53 proxy_service_); |
51 } | 54 } |
52 | 55 |
53 explicit TestURLRequestContext(const std::string& proxy) { | 56 explicit TestURLRequestContext(const std::string& proxy) { |
54 // TODO(eroman): we turn off host caching to see if synchronous | 57 // TODO(eroman): we turn off host caching to see if synchronous |
55 // host resolving interacts poorly with client socket pool. [experiment] | 58 // host resolving interacts poorly with client socket pool. [experiment] |
56 // http://crbug.com/13952 | 59 // http://crbug.com/13952 |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 556 |
554 MessageLoop::current()->Run(); | 557 MessageLoop::current()->Run(); |
555 if (request.is_pending()) | 558 if (request.is_pending()) |
556 return false; | 559 return false; |
557 | 560 |
558 return true; | 561 return true; |
559 } | 562 } |
560 }; | 563 }; |
561 | 564 |
562 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 565 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
OLD | NEW |