| 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 10 matching lines...) Expand all Loading... |
| 21 int code; | 21 int code; |
| 22 std::string bytes; | 22 std::string bytes; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 // A non-mock URL request which can access http:// and file:// urls. | 25 // A non-mock URL request which can access http:// and file:// urls. |
| 26 class RequestContext : public URLRequestContext { | 26 class RequestContext : public URLRequestContext { |
| 27 public: | 27 public: |
| 28 RequestContext() { | 28 RequestContext() { |
| 29 net::ProxyInfo no_proxy; | 29 net::ProxyInfo no_proxy; |
| 30 proxy_service_ = net::ProxyService::Create(&no_proxy); | 30 proxy_service_ = net::ProxyService::Create(&no_proxy); |
| 31 http_transaction_factory_ = net::HttpNetworkLayer::CreateFactory( | 31 http_transaction_factory_.reset(net::HttpNetworkLayer::CreateFactory( |
| 32 proxy_service_); | 32 proxy_service_)); |
| 33 } | |
| 34 ~RequestContext() { | |
| 35 delete http_transaction_factory_; | |
| 36 delete proxy_service_; | |
| 37 } | 33 } |
| 38 }; | 34 }; |
| 39 | 35 |
| 40 // Helper for doing synch fetches. This object lives in SynchFetcher's | 36 // Helper for doing synch fetches. This object lives in SynchFetcher's |
| 41 // |io_thread_| and communicates with SynchFetcher though (|result|, |event|). | 37 // |io_thread_| and communicates with SynchFetcher though (|result|, |event|). |
| 42 class SynchFetcherThreadHelper { | 38 class SynchFetcherThreadHelper { |
| 43 public: | 39 public: |
| 44 SynchFetcherThreadHelper(base::WaitableEvent* event, FetchResult* result) | 40 SynchFetcherThreadHelper(base::WaitableEvent* event, FetchResult* result) |
| 45 : event_(event), | 41 : event_(event), |
| 46 fetch_result_(result), | 42 fetch_result_(result), |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 281 |
| 286 { // Make sure we can still fetch regular URLs. | 282 { // Make sure we can still fetch regular URLs. |
| 287 GURL url = server.TestServerPage("files/pac.nsproxy"); | 283 GURL url = server.TestServerPage("files/pac.nsproxy"); |
| 288 FetchResult result = pac_fetcher.Fetch(url); | 284 FetchResult result = pac_fetcher.Fetch(url); |
| 289 EXPECT_EQ(net::OK, result.code); | 285 EXPECT_EQ(net::OK, result.code); |
| 290 EXPECT_EQ("-pac.nsproxy-\n", result.bytes); | 286 EXPECT_EQ("-pac.nsproxy-\n", result.bytes); |
| 291 } | 287 } |
| 292 } | 288 } |
| 293 | 289 |
| 294 } // namespace net | 290 } // namespace net |
| OLD | NEW |