| 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" |
| 11 #include "net/url_request/url_request_unittest.h" | 11 #include "net/url_request/url_request_unittest.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
| 14 | 14 |
| 15 // TODO(eroman): | 15 // TODO(eroman): |
| 16 // - Test canceling an outstanding request. | 16 // - Test canceling an outstanding request. |
| 17 // - Test deleting ProxyScriptFetcher while a request is in progress. | 17 // - Test deleting ProxyScriptFetcher while a request is in progress. |
| 18 | 18 |
| 19 const wchar_t kDocRoot[] = L"net/data/proxy_script_fetcher_unittest"; | 19 const wchar_t kDocRoot[] = L"net/data/proxy_script_fetcher_unittest"; |
| 20 | 20 |
| 21 struct FetchResult { | 21 struct FetchResult { |
| 22 int code; | 22 int code; |
| 23 std::string bytes; | 23 std::string bytes; |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 // A non-mock URL request which can access http:// and file:// urls. | 26 // A non-mock URL request which can access http:// and file:// urls. |
| 27 class RequestContext : public URLRequestContext { | 27 class RequestContext : public URLRequestContext { |
| 28 public: | 28 public: |
| 29 RequestContext() { | 29 RequestContext() { |
| 30 net::ProxyInfo no_proxy; | 30 net::ProxyConfig no_proxy; |
| 31 proxy_service_ = net::ProxyService::Create(&no_proxy); | 31 proxy_service_ = net::ProxyService::Create(&no_proxy); |
| 32 http_transaction_factory_ = net::HttpNetworkLayer::CreateFactory( | 32 http_transaction_factory_ = net::HttpNetworkLayer::CreateFactory( |
| 33 proxy_service_); | 33 proxy_service_); |
| 34 } | 34 } |
| 35 ~RequestContext() { | 35 ~RequestContext() { |
| 36 delete http_transaction_factory_; | 36 delete http_transaction_factory_; |
| 37 delete proxy_service_; | 37 delete proxy_service_; |
| 38 } | 38 } |
| 39 }; | 39 }; |
| 40 | 40 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 { // Make sure we can still fetch regular URLs. | 299 { // Make sure we can still fetch regular URLs. |
| 300 GURL url = server->TestServerPage("files/pac.nsproxy"); | 300 GURL url = server->TestServerPage("files/pac.nsproxy"); |
| 301 FetchResult result = pac_fetcher.Fetch(url); | 301 FetchResult result = pac_fetcher.Fetch(url); |
| 302 EXPECT_EQ(net::OK, result.code); | 302 EXPECT_EQ(net::OK, result.code); |
| 303 EXPECT_EQ("-pac.nsproxy-\n", result.bytes); | 303 EXPECT_EQ("-pac.nsproxy-\n", result.bytes); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace net | 307 } // namespace net |
| OLD | NEW |