summaryrefslogtreecommitdiffstats
path: root/net/proxy
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-31 05:02:26 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-31 05:02:26 +0000
commit3470ff62ac049236c78338c9e12b0345e4b77469 (patch)
tree9e10ba5b8ccd895c129ba5c173bd55e022396532 /net/proxy
parent07e6582331343b2e6e1e0f25261429e2a7d51f3e (diff)
downloadchromium_src-3470ff62ac049236c78338c9e12b0345e4b77469.zip
chromium_src-3470ff62ac049236c78338c9e12b0345e4b77469.tar.gz
chromium_src-3470ff62ac049236c78338c9e12b0345e4b77469.tar.bz2
Get rid of synchronous ResolveProxy API.
Also remove the ProxyInfo::Apply method. Review URL: http://codereview.chromium.org/19502 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9015 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r--net/proxy/proxy_service.cc102
-rw-r--r--net/proxy/proxy_service.h15
-rw-r--r--net/proxy/proxy_service_unittest.cc163
3 files changed, 130 insertions, 150 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 4745bce..8d4025b 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -166,26 +166,6 @@ void ProxyInfo::UseNamedProxy(const std::string& proxy_server) {
proxy_list_.Set(proxy_server);
}
-#if defined(OS_WIN)
-void ProxyInfo::Apply(HINTERNET request_handle) {
- WINHTTP_PROXY_INFO pi;
- std::wstring proxy; // We need to declare this variable here because
- // lpszProxy needs to be valid in WinHttpSetOption.
- if (is_direct()) {
- pi.dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
- pi.lpszProxy = WINHTTP_NO_PROXY_NAME;
- pi.lpszProxyBypass = WINHTTP_NO_PROXY_BYPASS;
- } else {
- proxy = ASCIIToWide(proxy_list_.Get());
- pi.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
- pi.lpszProxy = const_cast<LPWSTR>(proxy.c_str());
- // NOTE: Specifying a bypass list here would serve no purpose.
- pi.lpszProxyBypass = WINHTTP_NO_PROXY_BYPASS;
- }
- WinHttpSetOption(request_handle, WINHTTP_OPTION_PROXY, &pi, sizeof(pi));
-}
-#endif
-
std::string ProxyInfo::GetAnnotatedProxyList() {
return is_direct() ? "DIRECT" : proxy_list_.GetAnnotatedList();
}
@@ -206,23 +186,17 @@ class ProxyService::PacRequest :
results_(NULL),
config_id_(service->config_id()),
pac_url_(pac_url),
- origin_loop_(NULL) {
- // We need to remember original loop if only in case of asynchronous call
- if (callback_)
- origin_loop_ = MessageLoop::current();
+ origin_loop_(MessageLoop::current()) {
+ DCHECK(callback);
}
void Query(const GURL& url, ProxyInfo* results) {
results_ = results;
- // If we have a valid callback then execute Query asynchronously
- if (callback_) {
- AddRef(); // balanced in QueryComplete
- service_->pac_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(this, &ProxyService::PacRequest::DoQuery,
- service_->resolver(), url, pac_url_));
- } else {
- DoQuery(service_->resolver(), url, pac_url_);
- }
+ // Execute Query asynchronously
+ AddRef(); // balanced in QueryComplete
+ service_->pac_thread()->message_loop()->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &ProxyService::PacRequest::DoQuery,
+ service_->resolver(), url, pac_url_));
}
void Cancel() {
@@ -234,37 +208,33 @@ class ProxyService::PacRequest :
}
private:
- // Runs on the PAC thread if a valid callback is provided.
+ // Runs on the PAC thread.
void DoQuery(ProxyResolver* resolver,
const GURL& query_url,
const GURL& pac_url) {
int rv = resolver->GetProxyForURL(query_url, pac_url, &results_buf_);
- if (origin_loop_) {
- origin_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &PacRequest::QueryComplete, rv));
- } else {
- QueryComplete(rv);
- }
+ origin_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &PacRequest::QueryComplete, rv));
}
- // If a valid callback is provided, this runs on the origin thread to
- // indicate that the completion callback should be run.
+ // Runs the completion callback on the origin thread.
void QueryComplete(int result_code) {
- if (service_)
- service_->DidCompletePacRequest(config_id_, result_code);
+ // The PacRequest may have been cancelled after it was started. If it was
+ // cancelled then |callback_|, |service_|, and |results_| will be NULL.
+ bool was_cancelled = callback_ == NULL;
- if (result_code == OK && results_) {
- results_->Use(results_buf_);
- results_->RemoveBadProxies(service_->proxy_retry_info_);
- }
+ if (!was_cancelled) {
+ service_->DidCompletePacRequest(config_id_, result_code);
- if (callback_)
+ if (result_code == OK) {
+ results_->Use(results_buf_);
+ results_->RemoveBadProxies(service_->proxy_retry_info_);
+ }
callback_->Run(result_code);
-
- if (origin_loop_) {
- Release(); // balances the AddRef in Query. we may get deleted after
- // we return.
}
+
+ Release(); // balances the AddRef in Query. we may get deleted after
+ // we return.
}
// Must only be used on the "origin" thread.
@@ -322,6 +292,7 @@ ProxyService* ProxyService::CreateNull() {
int ProxyService::ResolveProxy(const GURL& url, ProxyInfo* result,
CompletionCallback* callback,
PacRequest** pac_request) {
+ DCHECK(callback);
// The overhead of calling ProxyConfigService::GetProxyConfig is very low.
const TimeDelta kProxyConfigMaxAge = TimeDelta::FromSeconds(5);
@@ -382,18 +353,11 @@ int ProxyService::ResolveProxy(const GURL& url, ProxyInfo* result,
}
if (config_.pac_url.is_valid() || config_.auto_detect) {
- if (callback) {
- // Create PAC thread for asynchronous mode.
- if (!pac_thread_.get()) {
- pac_thread_.reset(new base::Thread("pac-thread"));
- pac_thread_->Start();
- }
- } else {
- // If this request is synchronous, then there's no point
- // in returning PacRequest instance
- DCHECK(!pac_request);
+ if (!pac_thread_.get()) {
+ pac_thread_.reset(new base::Thread("pac-thread"));
+ pac_thread_->Start();
}
-
+
scoped_refptr<PacRequest> req =
new PacRequest(this, config_.pac_url, callback);
@@ -411,12 +375,10 @@ int ProxyService::ResolveProxy(const GURL& url, ProxyInfo* result,
req->Query(sanitized_url, result);
- if (callback) {
- if (pac_request)
- *pac_request = req;
- return ERR_IO_PENDING; // Wait for callback.
- }
- return OK;
+ if (pac_request)
+ *pac_request = req;
+
+ return ERR_IO_PENDING; // Wait for callback.
}
}
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index 846a2d9..2553124 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -17,10 +17,6 @@
#include "googleurl/src/gurl.h"
#include "net/base/completion_callback.h"
-#if defined(OS_WIN)
-typedef LPVOID HINTERNET; // From winhttp.h
-#endif
-
class GURL;
namespace net {
@@ -94,9 +90,9 @@ class ProxyService {
// Used internally to handle PAC queries.
class PacRequest;
- // Returns OK if proxy information could be provided synchronously. Else,
- // ERR_IO_PENDING is returned to indicate that the result will be available
- // when the callback is run. The callback is run on the thread that calls
+ // Returns ERR_IO_PENDING if the proxy information could not be provided
+ // synchronously, to indicate that the result will be available when the
+ // callback is run. The callback is run on the thread that calls
// ResolveProxy.
//
// The caller is responsible for ensuring that |results| and |callback|
@@ -246,11 +242,6 @@ class ProxyInfo {
// This may optionally be a semi-colon delimited list of proxy servers.
void UseNamedProxy(const std::string& proxy_server);
-#if defined(OS_WIN)
- // Apply this proxy information to the given WinHTTP request handle.
- void Apply(HINTERNET request_handle);
-#endif
-
// Returns true if this proxy info specifies a direct connection.
bool is_direct() const { return proxy_list_.Get().empty(); }
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
index 48a8721..d90843d 100644
--- a/net/proxy/proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -9,8 +9,6 @@
namespace {
-// TODO(eroman): get rid of synchronous usages of ProxyService::ResolveProxy().
-
class MockProxyConfigService: public net::ProxyConfigService {
public:
MockProxyConfigService() {} // Direct connect.
@@ -55,6 +53,33 @@ class MockProxyResolver : public net::ProxyResolver {
bool fail_get_proxy_for_url;
};
+class SyncProxyService {
+ public:
+ SyncProxyService(net::ProxyConfigService* config_service,
+ net::ProxyResolver* resolver)
+ : io_thread_("IO_Thread"),
+ service_(config_service, resolver) {
+ base::Thread::Options options;
+ options.message_loop_type = MessageLoop::TYPE_IO;
+ io_thread_.StartWithOptions(options);
+ sync_proxy_service_ = new net::SyncProxyServiceHelper(
+ io_thread_.message_loop(), &service_);
+ }
+
+ int ResolveProxy(const GURL& url, net::ProxyInfo* proxy_info) {
+ return sync_proxy_service_->ResolveProxy(url, proxy_info);
+ }
+
+ int ReconsiderProxyAfterError(const GURL& url, net::ProxyInfo* proxy_info) {
+ return sync_proxy_service_->ReconsiderProxyAfterError(url, proxy_info);
+ }
+
+ private:
+ base::Thread io_thread_;
+ net::ProxyService service_;
+ scoped_refptr<net::SyncProxyServiceHelper> sync_proxy_service_;
+};
+
} // namespace
// GetAnnotatedList() is used to generate a string for mozilla's GetProxyForUrl
@@ -72,13 +97,13 @@ TEST(ProxyListTest, GetAnnotatedList) {
}
TEST(ProxyServiceTest, Direct) {
- net::ProxyService service(new MockProxyConfigService,
- new MockProxyResolver);
+ SyncProxyService service(new MockProxyConfigService,
+ new MockProxyResolver);
GURL url("http://www.google.com/");
net::ProxyInfo info;
- int rv = service.ResolveProxy(url, &info, NULL, NULL);
+ int rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info.is_direct());
}
@@ -91,12 +116,12 @@ TEST(ProxyServiceTest, PAC) {
resolver->info.UseNamedProxy("foopy");
resolver->info_predicate_query_host = "www.google.com";
- net::ProxyService service(config_service, resolver);
+ SyncProxyService service(config_service, resolver);
GURL url("http://www.google.com/");
net::ProxyInfo info;
- int rv = service.ResolveProxy(url, &info, NULL, NULL);
+ int rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ(info.proxy_server(), "foopy");
@@ -110,18 +135,18 @@ TEST(ProxyServiceTest, PAC_FailoverToDirect) {
resolver->info.UseNamedProxy("foopy:8080");
resolver->info_predicate_query_host = "www.google.com";
- net::ProxyService service(config_service, resolver);
+ SyncProxyService service(config_service, resolver);
GURL url("http://www.google.com/");
net::ProxyInfo info;
- int rv = service.ResolveProxy(url, &info, NULL, NULL);
+ int rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ(info.proxy_server(), "foopy:8080");
// Now, imagine that connecting to foopy:8080 fails.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info.is_direct());
}
@@ -137,15 +162,17 @@ TEST(ProxyServiceTest, PAC_FailsToDownload) {
resolver->info_predicate_query_host = "www.google.com";
resolver->fail_get_proxy_for_url = true;
- net::ProxyService service(config_service, resolver);
+ SyncProxyService service(config_service, resolver);
+ // The first resolve fails in the MockProxyResolver.
GURL url("http://www.google.com/");
net::ProxyInfo info;
- int rv = service.ResolveProxy(url, &info, NULL, NULL);
- EXPECT_EQ(rv, net::OK);
- EXPECT_TRUE(info.is_direct());
+ int rv = service.ResolveProxy(url, &info);
+ EXPECT_EQ(rv, net::ERR_FAILED);
- rv = service.ResolveProxy(url, &info, NULL, NULL);
+ // The second resolve request will automatically select direct connect,
+ // because it has cached the configuration as being bad.
+ rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info.is_direct());
@@ -154,7 +181,7 @@ TEST(ProxyServiceTest, PAC_FailsToDownload) {
// But, if that fails, then we should give the proxy config another shot
// since we have never tried it with this URL before.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ(info.proxy_server(), "foopy_valid:8080");
@@ -172,13 +199,13 @@ TEST(ProxyServiceTest, ProxyFallback) {
resolver->info_predicate_query_host = "www.google.com";
resolver->fail_get_proxy_for_url = false;
- net::ProxyService service(config_service, resolver);
+ SyncProxyService service(config_service, resolver);
GURL url("http://www.google.com/");
// Get the proxy information.
net::ProxyInfo info;
- int rv = service.ResolveProxy(url, &info, NULL, NULL);
+ int rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
@@ -186,7 +213,7 @@ TEST(ProxyServiceTest, ProxyFallback) {
EXPECT_EQ(info.proxy_server(), "foopy1:8080");
// Fake an error on the proxy.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK);
// The second proxy should be specified.
@@ -199,23 +226,23 @@ TEST(ProxyServiceTest, ProxyFallback) {
resolver->info_predicate_query_host = "www.google.com";
resolver->fail_get_proxy_for_url = false;
- rv = service.ResolveProxy(url, &info, NULL, NULL);
+ rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ(info.proxy_server(), "foopy3:7070");
// We fake another error. It should now try the third one.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_EQ(info.proxy_server(), "foopy2:9090");
// Fake another error, the last proxy is gone, the list should now be empty.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK); // We try direct.
EXPECT_TRUE(info.is_direct());
// If it fails again, we don't have anything else to try.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::ERR_FAILED); // We try direct.
// TODO(nsylvain): Test that the proxy can be retried after the delay.
@@ -232,13 +259,13 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) {
resolver->info_predicate_query_host = "www.google.com";
resolver->fail_get_proxy_for_url = false;
- net::ProxyService service(config_service, resolver);
+ SyncProxyService service(config_service, resolver);
GURL url("http://www.google.com/");
// Get the proxy information.
net::ProxyInfo info;
- int rv = service.ResolveProxy(url, &info, NULL, NULL);
+ int rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
@@ -249,14 +276,14 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) {
config_service->config = net::ProxyConfig();
config_service->config.pac_url = GURL("http://foopy-new/proxy.pac");
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK);
// The first proxy is still there since the configuration changed.
EXPECT_EQ(info.proxy_server(), "foopy1:8080");
// We fake another error. It should now ignore the first one.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_EQ(info.proxy_server(), "foopy2:9090");
@@ -265,7 +292,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) {
config_service->config.pac_url = GURL("http://foopy-new2/proxy.pac");
// We fake anothe error. It should go back to the first proxy.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_EQ(info.proxy_server(), "foopy1:8080");
}
@@ -281,13 +308,13 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
resolver->info_predicate_query_host = "www.google.com";
resolver->fail_get_proxy_for_url = false;
- net::ProxyService service(config_service, resolver);
+ SyncProxyService service(config_service, resolver);
GURL url("http://www.google.com/");
// Get the proxy information.
net::ProxyInfo info;
- int rv = service.ResolveProxy(url, &info, NULL, NULL);
+ int rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
@@ -295,7 +322,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
EXPECT_EQ(info.proxy_server(), "foopy1:8080");
// Fake a proxy error.
- rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info);
EXPECT_EQ(rv, net::OK);
// The first proxy is ignored, and the second one is selected.
@@ -305,8 +332,8 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
// Fake a PAC failure.
net::ProxyInfo info2;
resolver->fail_get_proxy_for_url = true;
- rv = service.ResolveProxy(url, &info2, NULL, NULL);
- EXPECT_EQ(rv, net::OK);
+ rv = service.ResolveProxy(url, &info2);
+ EXPECT_EQ(rv, net::ERR_FAILED);
// No proxy servers are returned. It's a direct connection.
EXPECT_TRUE(info2.is_direct());
@@ -318,14 +345,14 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
// Try to resolve, it will still return "direct" because we have no reason
// to check the config since everything works.
net::ProxyInfo info3;
- rv = service.ResolveProxy(url, &info3, NULL, NULL);
+ rv = service.ResolveProxy(url, &info3);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info3.is_direct());
// But if the direct connection fails, we check if the ProxyInfo tried to
// resolve the proxy before, and if not (like in this case), we give the
// PAC another try.
- rv = service.ReconsiderProxyAfterError(url, &info3, NULL, NULL);
+ rv = service.ReconsiderProxyAfterError(url, &info3);
EXPECT_EQ(rv, net::OK);
// The first proxy is still there since the list of bad proxies got cleared.
@@ -341,31 +368,31 @@ TEST(ProxyServiceTest, ProxyBypassList) {
config.auto_detect = false;
config.proxy_bypass_local_names = true;
- net::ProxyService service(new MockProxyConfigService(config),
- new MockProxyResolver());
+ SyncProxyService service(new MockProxyConfigService(config),
+ new MockProxyResolver());
GURL url("http://www.google.com/");
// Get the proxy information.
net::ProxyInfo info;
- int rv = service.ResolveProxy(url, &info, NULL, NULL);
+ int rv = service.ResolveProxy(url, &info);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
- net::ProxyService service1(new MockProxyConfigService(config),
- new MockProxyResolver());
+ SyncProxyService service1(new MockProxyConfigService(config),
+ new MockProxyResolver());
GURL test_url1("local");
net::ProxyInfo info1;
- rv = service1.ResolveProxy(test_url1, &info1, NULL, NULL);
+ rv = service1.ResolveProxy(test_url1, &info1);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info1.is_direct());
config.proxy_bypass.clear();
config.proxy_bypass.push_back("*.org");
config.proxy_bypass_local_names = true;
- net::ProxyService service2(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service2(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url2("http://www.webkit.org");
net::ProxyInfo info2;
- rv = service2.ResolveProxy(test_url2, &info2, NULL, NULL);
+ rv = service2.ResolveProxy(test_url2, &info2);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info2.is_direct());
@@ -373,44 +400,44 @@ TEST(ProxyServiceTest, ProxyBypassList) {
config.proxy_bypass.push_back("*.org");
config.proxy_bypass.push_back("7*");
config.proxy_bypass_local_names = true;
- net::ProxyService service3(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service3(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url3("http://74.125.19.147");
net::ProxyInfo info3;
- rv = service3.ResolveProxy(test_url3, &info3, NULL, NULL);
+ rv = service3.ResolveProxy(test_url3, &info3);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info3.is_direct());
config.proxy_bypass.clear();
config.proxy_bypass.push_back("*.org");
config.proxy_bypass_local_names = true;
- net::ProxyService service4(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service4(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url4("http://www.msn.com");
net::ProxyInfo info4;
- rv = service4.ResolveProxy(test_url4, &info4, NULL, NULL);
+ rv = service4.ResolveProxy(test_url4, &info4);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info4.is_direct());
config.proxy_bypass.clear();
config.proxy_bypass.push_back("*.MSN.COM");
config.proxy_bypass_local_names = true;
- net::ProxyService service5(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service5(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url5("http://www.msnbc.msn.com");
net::ProxyInfo info5;
- rv = service5.ResolveProxy(test_url5, &info5, NULL, NULL);
+ rv = service5.ResolveProxy(test_url5, &info5);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info5.is_direct());
config.proxy_bypass.clear();
config.proxy_bypass.push_back("*.msn.com");
config.proxy_bypass_local_names = true;
- net::ProxyService service6(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service6(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url6("HTTP://WWW.MSNBC.MSN.COM");
net::ProxyInfo info6;
- rv = service6.ResolveProxy(test_url6, &info6, NULL, NULL);
+ rv = service6.ResolveProxy(test_url6, &info6);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info6.is_direct());
}
@@ -420,39 +447,39 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) {
config.proxy_server = "http=foopy1:8080;https=foopy2:8080";
config.auto_detect = false;
- net::ProxyService service1(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service1(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url1("http://www.msn.com");
net::ProxyInfo info1;
- int rv = service1.ResolveProxy(test_url1, &info1, NULL, NULL);
+ int rv = service1.ResolveProxy(test_url1, &info1);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info1.is_direct());
EXPECT_TRUE(info1.proxy_server() == "foopy1:8080");
- net::ProxyService service2(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service2(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url2("ftp://ftp.google.com");
net::ProxyInfo info2;
- rv = service2.ResolveProxy(test_url2, &info2, NULL, NULL);
+ rv = service2.ResolveProxy(test_url2, &info2);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info2.is_direct());
EXPECT_TRUE(info2.proxy_server() == "");
- net::ProxyService service3(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service3(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url3("https://webbranch.techcu.com");
net::ProxyInfo info3;
- rv = service3.ResolveProxy(test_url3, &info3, NULL, NULL);
+ rv = service3.ResolveProxy(test_url3, &info3);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info3.is_direct());
EXPECT_TRUE(info3.proxy_server() == "foopy2:8080");
config.proxy_server = "foopy1:8080";
- net::ProxyService service4(new MockProxyConfigService(config),
- new MockProxyResolver);
+ SyncProxyService service4(new MockProxyConfigService(config),
+ new MockProxyResolver);
GURL test_url4("www.microsoft.com");
net::ProxyInfo info4;
- rv = service4.ResolveProxy(test_url4, &info4, NULL, NULL);
+ rv = service4.ResolveProxy(test_url4, &info4);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info4.is_direct());
EXPECT_TRUE(info4.proxy_server() == "foopy1:8080");