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