OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "net/proxy/proxy_script_fetcher.h" | 5 #include "net/proxy/proxy_script_fetcher.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 net::ProxyConfig no_proxy; | 34 net::ProxyConfig no_proxy; |
35 host_resolver_ = net::CreateSystemHostResolver(); | 35 host_resolver_ = net::CreateSystemHostResolver(); |
36 proxy_service_ = net::ProxyService::CreateFixed(no_proxy); | 36 proxy_service_ = net::ProxyService::CreateFixed(no_proxy); |
37 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 37 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
38 | 38 |
39 http_transaction_factory_ = | 39 http_transaction_factory_ = |
40 new net::HttpCache(net::HttpNetworkLayer::CreateFactory( | 40 new net::HttpCache(net::HttpNetworkLayer::CreateFactory( |
41 host_resolver_, proxy_service_, ssl_config_service_), | 41 host_resolver_, proxy_service_, ssl_config_service_), |
42 disk_cache::CreateInMemoryCacheBackend(0)); | 42 disk_cache::CreateInMemoryCacheBackend(0)); |
43 } | 43 } |
| 44 |
| 45 private: |
44 ~RequestContext() { | 46 ~RequestContext() { |
45 delete http_transaction_factory_; | 47 delete http_transaction_factory_; |
46 } | 48 } |
47 }; | 49 }; |
48 | 50 |
49 // Required to be in net namespace by FRIEND_TEST. | 51 // Required to be in net namespace by FRIEND_TEST. |
50 namespace net { | 52 namespace net { |
51 | 53 |
52 // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. | 54 // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. |
53 GURL GetTestFileUrl(const std::string& relpath) { | 55 GURL GetTestFileUrl(const std::string& relpath) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 std::string bytes; | 319 std::string bytes; |
318 TestCompletionCallback callback; | 320 TestCompletionCallback callback; |
319 int result = pac_fetcher->Fetch(url, &bytes, &callback); | 321 int result = pac_fetcher->Fetch(url, &bytes, &callback); |
320 EXPECT_EQ(ERR_IO_PENDING, result); | 322 EXPECT_EQ(ERR_IO_PENDING, result); |
321 EXPECT_EQ(OK, callback.WaitForResult()); | 323 EXPECT_EQ(OK, callback.WaitForResult()); |
322 EXPECT_EQ("This was encoded as UTF-16BE.\n", bytes); | 324 EXPECT_EQ("This was encoded as UTF-16BE.\n", bytes); |
323 } | 325 } |
324 } | 326 } |
325 | 327 |
326 } // namespace net | 328 } // namespace net |
OLD | NEW |