| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "net/base/mock_cert_verifier.h" | 13 #include "net/base/mock_cert_verifier.h" |
| 14 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
| 15 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
| 16 #include "net/base/ssl_config_service_defaults.h" | 16 #include "net/base/ssl_config_service_defaults.h" |
| 17 #include "net/base/test_completion_callback.h" | 17 #include "net/base/test_completion_callback.h" |
| 18 #include "net/disk_cache/disk_cache.h" | 18 #include "net/disk_cache/disk_cache.h" |
| 19 #include "net/http/http_cache.h" | 19 #include "net/http/http_cache.h" |
| 20 #include "net/http/http_network_session.h" | 20 #include "net/http/http_network_session.h" |
| 21 #include "net/http/http_server_properties_impl.h" | 21 #include "net/http/http_server_properties_impl.h" |
| 22 #include "net/test/test_server.h" | 22 #include "net/test/test_server.h" |
| 23 #include "net/url_request/url_request_context_storage.h" | 23 #include "net/url_request/url_request_context_storage.h" |
| 24 #include "net/url_request/url_request_job_factory.h" | 24 #include "net/url_request/url_request_job_factory.h" |
| 25 #include "net/url_request/url_request_test_util.h" | 25 #include "net/url_request/url_request_test_util.h" |
| 26 #include "net/url_request/url_request_throttler_manager.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 27 #include "testing/platform_test.h" | 28 #include "testing/platform_test.h" |
| 28 | 29 |
| 29 namespace net { | 30 namespace net { |
| 30 | 31 |
| 31 // TODO(eroman): | 32 // TODO(eroman): |
| 32 // - Test canceling an outstanding request. | 33 // - Test canceling an outstanding request. |
| 33 // - Test deleting ProxyScriptFetcher while a request is in progress. | 34 // - Test deleting ProxyScriptFetcher while a request is in progress. |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 RequestContext() : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { | 71 RequestContext() : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { |
| 71 ProxyConfig no_proxy; | 72 ProxyConfig no_proxy; |
| 72 storage_.set_host_resolver( | 73 storage_.set_host_resolver( |
| 73 CreateSystemHostResolver(HostResolver::kDefaultParallelism, | 74 CreateSystemHostResolver(HostResolver::kDefaultParallelism, |
| 74 HostResolver::kDefaultRetryAttempts, | 75 HostResolver::kDefaultRetryAttempts, |
| 75 NULL)); | 76 NULL)); |
| 76 storage_.set_cert_verifier(new MockCertVerifier); | 77 storage_.set_cert_verifier(new MockCertVerifier); |
| 77 storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy)); | 78 storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy)); |
| 78 storage_.set_ssl_config_service(new SSLConfigServiceDefaults); | 79 storage_.set_ssl_config_service(new SSLConfigServiceDefaults); |
| 79 storage_.set_http_server_properties(new HttpServerPropertiesImpl); | 80 storage_.set_http_server_properties(new HttpServerPropertiesImpl); |
| 81 storage_.set_throttler_manager(new URLRequestThrottlerManager); |
| 80 | 82 |
| 81 HttpNetworkSession::Params params; | 83 HttpNetworkSession::Params params; |
| 82 params.host_resolver = host_resolver(); | 84 params.host_resolver = host_resolver(); |
| 83 params.cert_verifier = cert_verifier(); | 85 params.cert_verifier = cert_verifier(); |
| 84 params.proxy_service = proxy_service(); | 86 params.proxy_service = proxy_service(); |
| 85 params.ssl_config_service = ssl_config_service(); | 87 params.ssl_config_service = ssl_config_service(); |
| 86 params.http_server_properties = http_server_properties(); | 88 params.http_server_properties = http_server_properties(); |
| 87 scoped_refptr<HttpNetworkSession> network_session( | 89 scoped_refptr<HttpNetworkSession> network_session( |
| 88 new HttpNetworkSession(params)); | 90 new HttpNetworkSession(params)); |
| 89 storage_.set_http_transaction_factory(new HttpCache( | 91 storage_.set_http_transaction_factory(new HttpCache( |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 { | 411 { |
| 410 GURL url(kEncodedUrlBroken); | 412 GURL url(kEncodedUrlBroken); |
| 411 string16 text; | 413 string16 text; |
| 412 TestCompletionCallback callback; | 414 TestCompletionCallback callback; |
| 413 int result = pac_fetcher.Fetch(url, &text, callback.callback()); | 415 int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
| 414 EXPECT_EQ(ERR_FAILED, result); | 416 EXPECT_EQ(ERR_FAILED, result); |
| 415 } | 417 } |
| 416 } | 418 } |
| 417 | 419 |
| 418 } // namespace net | 420 } // namespace net |
| OLD | NEW |