diff options
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/proxy_resolver_js_bindings.cc | 5 | ||||
-rw-r--r-- | net/proxy/proxy_service.cc | 31 | ||||
-rw-r--r-- | net/proxy/proxy_service.h | 20 | ||||
-rw-r--r-- | net/proxy/proxy_service_unittest.cc | 141 |
4 files changed, 107 insertions, 90 deletions
diff --git a/net/proxy/proxy_resolver_js_bindings.cc b/net/proxy/proxy_resolver_js_bindings.cc index 6787b1b..723c91e 100644 --- a/net/proxy/proxy_resolver_js_bindings.cc +++ b/net/proxy/proxy_resolver_js_bindings.cc @@ -38,7 +38,7 @@ class SyncHostResolverBridge // Hack for tests -- run synchronously on current thread. if (!host_resolver_loop_) - return host_resolver_->Resolve(info, addresses, NULL, NULL); + return host_resolver_->Resolve(NULL, info, addresses, NULL, NULL); // Otherwise start an async resolve on the resolver's thread. host_resolver_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, @@ -54,7 +54,8 @@ class SyncHostResolverBridge void StartResolve(const HostResolver::RequestInfo& info, net::AddressList* addresses) { DCHECK_EQ(host_resolver_loop_, MessageLoop::current()); - int error = host_resolver_->Resolve(info, addresses, &callback_, NULL); + int error = host_resolver_->Resolve( + NULL, info, addresses, &callback_, NULL); if (error != ERR_IO_PENDING) OnResolveCompletion(error); // Completed synchronously. } diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 1798421..43b7cfe 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -246,7 +246,9 @@ ProxyService* ProxyService::CreateNull() { return new ProxyService(new ProxyConfigServiceNull, new ProxyResolverNull); } -int ProxyService::ResolveProxy(const GURL& raw_url, ProxyInfo* result, +int ProxyService::ResolveProxy(LoadLog* load_log, + const GURL& raw_url, + ProxyInfo* result, CompletionCallback* callback, PacRequest** pac_request) { DCHECK(callback); @@ -403,7 +405,8 @@ void ProxyService::OnInitProxyResolverComplete(int result) { ResumeAllPendingRequests(); } -int ProxyService::ReconsiderProxyAfterError(const GURL& url, +int ProxyService::ReconsiderProxyAfterError(LoadLog* load_log, + const GURL& url, ProxyInfo* result, CompletionCallback* callback, PacRequest** pac_request) { @@ -429,7 +432,7 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url, // If we have a new config or the config was never tried, we delete the // list of bad proxies and we try again. proxy_retry_info_.clear(); - return ResolveProxy(url, result, callback, pac_request); + return ResolveProxy(load_log, url, result, callback, pac_request); } // We don't have new proxy settings to try, fallback to the next proxy @@ -699,12 +702,13 @@ SyncProxyServiceHelper::SyncProxyServiceHelper(MessageLoop* io_message_loop, DCHECK(io_message_loop_ != MessageLoop::current()); } -int SyncProxyServiceHelper::ResolveProxy(const GURL& url, +int SyncProxyServiceHelper::ResolveProxy(LoadLog* load_log, + const GURL& url, ProxyInfo* proxy_info) { DCHECK(io_message_loop_ != MessageLoop::current()); io_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, &SyncProxyServiceHelper::StartAsyncResolve, url)); + this, &SyncProxyServiceHelper::StartAsyncResolve, load_log, url)); event_.Wait(); @@ -714,12 +718,12 @@ int SyncProxyServiceHelper::ResolveProxy(const GURL& url, return result_; } -int SyncProxyServiceHelper::ReconsiderProxyAfterError(const GURL& url, - ProxyInfo* proxy_info) { +int SyncProxyServiceHelper::ReconsiderProxyAfterError( + LoadLog* load_log, const GURL& url, ProxyInfo* proxy_info) { DCHECK(io_message_loop_ != MessageLoop::current()); io_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, &SyncProxyServiceHelper::StartAsyncReconsider, url)); + this, &SyncProxyServiceHelper::StartAsyncReconsider, load_log, url)); event_.Wait(); @@ -729,16 +733,19 @@ int SyncProxyServiceHelper::ReconsiderProxyAfterError(const GURL& url, return result_; } -void SyncProxyServiceHelper::StartAsyncResolve(const GURL& url) { - result_ = proxy_service_->ResolveProxy(url, &proxy_info_, &callback_, NULL); +void SyncProxyServiceHelper::StartAsyncResolve(LoadLog* load_log, + const GURL& url) { + result_ = proxy_service_->ResolveProxy( + load_log, url, &proxy_info_, &callback_, NULL); if (result_ != net::ERR_IO_PENDING) { OnCompletion(result_); } } -void SyncProxyServiceHelper::StartAsyncReconsider(const GURL& url) { +void SyncProxyServiceHelper::StartAsyncReconsider(LoadLog* load_log, + const GURL& url) { result_ = proxy_service_->ReconsiderProxyAfterError( - url, &proxy_info_, &callback_, NULL); + load_log, url, &proxy_info_, &callback_, NULL); if (result_ != net::ERR_IO_PENDING) { OnCompletion(result_); } diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h index cc678f2..92e68c7 100644 --- a/net/proxy/proxy_service.h +++ b/net/proxy/proxy_service.h @@ -25,6 +25,7 @@ class URLRequestContext; namespace net { class InitProxyResolver; +class LoadLog; class ProxyConfigService; class ProxyResolver; class ProxyScriptFetcher; @@ -63,7 +64,10 @@ class ProxyService { // 3. WPAD auto-detection // // TODO(eroman): see http://crbug.com/9985; the outline above is too simple. - int ResolveProxy(const GURL& url, + // + // Profiling information for the request is saved to |load_log| if non-NULL. + int ResolveProxy(LoadLog* load_log, + const GURL& url, ProxyInfo* results, CompletionCallback* callback, PacRequest** pac_request); @@ -79,7 +83,9 @@ class ProxyService { // // Returns ERR_FAILED if there is not another proxy config to try. // - int ReconsiderProxyAfterError(const GURL& url, + // Profiling information for the request is saved to |load_log| if non-NULL. + int ReconsiderProxyAfterError(LoadLog* load_log, + const GURL& url, ProxyInfo* results, CompletionCallback* callback, PacRequest** pac_request); @@ -262,12 +268,14 @@ class SyncProxyServiceHelper SyncProxyServiceHelper(MessageLoop* io_message_loop, ProxyService* proxy_service); - int ResolveProxy(const GURL& url, ProxyInfo* proxy_info); - int ReconsiderProxyAfterError(const GURL& url, ProxyInfo* proxy_info); + int ResolveProxy(LoadLog* load_log, const GURL& url, ProxyInfo* proxy_info); + int ReconsiderProxyAfterError(LoadLog* load_log, + const GURL& url, + ProxyInfo* proxy_info); private: - void StartAsyncResolve(const GURL& url); - void StartAsyncReconsider(const GURL& url); + void StartAsyncResolve(LoadLog* load_log, const GURL& url); + void StartAsyncReconsider(LoadLog* load_log, const GURL& url); void OnCompletion(int result); diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc index f4deb67..8a2fb98 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc @@ -92,7 +92,7 @@ TEST(ProxyServiceTest, Direct) { ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(resolver->pending_requests().empty()); @@ -111,7 +111,7 @@ TEST(ProxyServiceTest, PAC) { ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -144,7 +144,7 @@ TEST(ProxyServiceTest, PAC_NoIdentityOrHash) { ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -171,7 +171,7 @@ TEST(ProxyServiceTest, PAC_FailoverToDirect) { ProxyInfo info; TestCompletionCallback callback1; - int rv = service.ResolveProxy(url, &info, &callback1, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -191,7 +191,7 @@ TEST(ProxyServiceTest, PAC_FailoverToDirect) { // Now, imagine that connecting to foopy:8080 fails. TestCompletionCallback callback2; - rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback2, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -213,7 +213,7 @@ TEST(ProxyServiceTest, ProxyResolverFails) { GURL url("http://www.google.com/"); ProxyInfo info; TestCompletionCallback callback1; - int rv = service.ResolveProxy(url, &info, &callback1, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -231,7 +231,7 @@ TEST(ProxyServiceTest, ProxyResolverFails) { // The second resolve request will automatically select direct connect, // because it has cached the configuration as being bad. TestCompletionCallback callback2; - rv = service.ResolveProxy(url, &info, &callback2, NULL); + rv = service.ResolveProxy(NULL, url, &info, &callback2, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); EXPECT_TRUE(resolver->pending_requests().empty()); @@ -239,7 +239,7 @@ TEST(ProxyServiceTest, ProxyResolverFails) { // But, if that fails, then we should give the proxy config another shot // since we have never tried it with this URL before. TestCompletionCallback callback3; - rv = service.ReconsiderProxyAfterError(url, &info, &callback3, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback3, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -270,7 +270,7 @@ TEST(ProxyServiceTest, ProxyFallback) { // Get the proxy information. ProxyInfo info; TestCompletionCallback callback1; - int rv = service.ResolveProxy(url, &info, &callback1, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -292,14 +292,14 @@ TEST(ProxyServiceTest, ProxyFallback) { // Fake an error on the proxy. TestCompletionCallback callback2; - rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback2, NULL); EXPECT_EQ(OK, rv); // The second proxy should be specified. EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); TestCompletionCallback callback3; - rv = service.ResolveProxy(url, &info, &callback3, NULL); + rv = service.ResolveProxy(NULL, url, &info, &callback3, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -317,19 +317,19 @@ TEST(ProxyServiceTest, ProxyFallback) { // We fake another error. It should now try the third one. TestCompletionCallback callback4; - rv = service.ReconsiderProxyAfterError(url, &info, &callback4, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback4, NULL); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); // Fake another error, the last proxy is gone, the list should now be empty. TestCompletionCallback callback5; - rv = service.ReconsiderProxyAfterError(url, &info, &callback5, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback5, NULL); EXPECT_EQ(OK, rv); // We try direct. EXPECT_TRUE(info.is_direct()); // If it fails again, we don't have anything else to try. TestCompletionCallback callback6; - rv = service.ReconsiderProxyAfterError(url, &info, &callback6, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback6, NULL); EXPECT_EQ(ERR_FAILED, rv); // TODO(nsylvain): Test that the proxy can be retried after the delay. @@ -350,7 +350,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) { // Get the proxy information. ProxyInfo info; TestCompletionCallback callback1; - int rv = service.ResolveProxy(url, &info, &callback1, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -375,7 +375,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) { config_service->config.pac_url = GURL("http://foopy-new/proxy.pac"); TestCompletionCallback callback2; - rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback2, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy-new/proxy.pac"), @@ -395,7 +395,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) { // We fake another error. It should now ignore the first one. TestCompletionCallback callback3; - rv = service.ReconsiderProxyAfterError(url, &info, &callback3, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback3, NULL); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); @@ -405,7 +405,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) { // We fake another error. It should go back to the first proxy. TestCompletionCallback callback4; - rv = service.ReconsiderProxyAfterError(url, &info, &callback4, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback4, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy-new2/proxy.pac"), @@ -438,7 +438,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { // Get the proxy information. ProxyInfo info; TestCompletionCallback callback1; - int rv = service.ResolveProxy(url, &info, &callback1, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -458,7 +458,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { // Fake a proxy error. TestCompletionCallback callback2; - rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback2, NULL); EXPECT_EQ(OK, rv); // The first proxy is ignored, and the second one is selected. @@ -468,7 +468,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { // Fake a PAC failure. ProxyInfo info2; TestCompletionCallback callback3; - rv = service.ResolveProxy(url, &info2, &callback3, NULL); + rv = service.ResolveProxy(NULL, url, &info2, &callback3, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -487,7 +487,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { // to check the config since everything works. ProxyInfo info3; TestCompletionCallback callback4; - rv = service.ResolveProxy(url, &info3, &callback4, NULL); + rv = service.ResolveProxy(NULL, url, &info3, &callback4, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info3.is_direct()); @@ -495,7 +495,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { // resolve the proxy before, and if not (like in this case), we give the // PAC another try. TestCompletionCallback callback5; - rv = service.ReconsiderProxyAfterError(url, &info3, &callback5, NULL); + rv = service.ReconsiderProxyAfterError(NULL, url, &info3, &callback5, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -526,7 +526,7 @@ TEST(ProxyServiceTest, ProxyBypassList) { GURL url("http://www.google.com/"); // Get the proxy information. TestCompletionCallback callback; - int rv = service.ResolveProxy(url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); } @@ -536,7 +536,7 @@ TEST(ProxyServiceTest, ProxyBypassList) { new MockAsyncProxyResolver()); GURL test_url("http://local"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -549,7 +549,7 @@ TEST(ProxyServiceTest, ProxyBypassList) { new MockAsyncProxyResolver); GURL test_url("http://www.webkit.org"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -563,7 +563,7 @@ TEST(ProxyServiceTest, ProxyBypassList) { new MockAsyncProxyResolver); GURL test_url("http://74.125.19.147"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -576,7 +576,7 @@ TEST(ProxyServiceTest, ProxyBypassList) { new MockAsyncProxyResolver); GURL test_url("http://www.msn.com"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); } @@ -589,7 +589,7 @@ TEST(ProxyServiceTest, ProxyBypassList) { new MockAsyncProxyResolver); GURL test_url("http://www.msnbc.msn.com"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -602,7 +602,7 @@ TEST(ProxyServiceTest, ProxyBypassList) { new MockAsyncProxyResolver); GURL test_url("HTTP://WWW.MSNBC.MSN.COM"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -624,21 +624,21 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) { { GURL test_url("http://www.example.com:99"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } { GURL test_url("http://www.example.com:100"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); } { GURL test_url("http://www.example.com"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); } @@ -651,7 +651,7 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) { new MockAsyncProxyResolver); GURL test_url("http://www.example.com"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -663,7 +663,7 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) { new MockAsyncProxyResolver); GURL test_url("http://www.example.com:99"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -677,14 +677,14 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) { { GURL test_url("http://[3ffe:2a00:100:7031::1]:99/"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } { GURL test_url("http://[3ffe:2a00:100:7031::1]/"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); } @@ -701,14 +701,14 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) { { GURL test_url("http://[3ffe:2a00:100:7031::1]:99/"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } { GURL test_url("http://[3ffe:2a00:100:7031::1]/"); TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); } @@ -725,7 +725,7 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) { GURL test_url("http://www.msn.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); @@ -736,7 +736,7 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) { GURL test_url("ftp://ftp.google.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); EXPECT_EQ("direct://", info.proxy_server().ToURI()); @@ -747,7 +747,7 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) { GURL test_url("https://webbranch.techcu.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foopy2:8080", info.proxy_server().ToURI()); @@ -759,7 +759,7 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) { GURL test_url("http://www.microsoft.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); @@ -781,7 +781,7 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) { GURL test_url("http://www.msn.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); @@ -792,7 +792,7 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) { GURL test_url("ftp://ftp.google.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI()); @@ -803,7 +803,7 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) { GURL test_url("https://webbranch.techcu.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI()); @@ -814,7 +814,7 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) { GURL test_url("unknown://www.microsoft.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service.ResolveProxy(test_url, &info, &callback, NULL); + int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI()); @@ -835,7 +835,7 @@ TEST(ProxyServiceTest, CancelInProgressRequest) { ProxyInfo info1; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://request1"), &info1, &callback1, NULL); + NULL, GURL("http://request1"), &info1, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); // Nothing has been sent to the proxy resolver yet, since the proxy @@ -854,7 +854,7 @@ TEST(ProxyServiceTest, CancelInProgressRequest) { TestCompletionCallback callback2; ProxyService::PacRequest* request2; rv = service.ResolveProxy( - GURL("http://request2"), &info2, &callback2, &request2); + NULL, GURL("http://request2"), &info2, &callback2, &request2); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(2u, resolver->pending_requests().size()); EXPECT_EQ(GURL("http://request2"), resolver->pending_requests()[1]->url()); @@ -862,7 +862,7 @@ TEST(ProxyServiceTest, CancelInProgressRequest) { ProxyInfo info3; TestCompletionCallback callback3; rv = service.ResolveProxy( - GURL("http://request3"), &info3, &callback3, NULL); + NULL, GURL("http://request3"), &info3, &callback3, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(3u, resolver->pending_requests().size()); EXPECT_EQ(GURL("http://request3"), resolver->pending_requests()[2]->url()); @@ -912,7 +912,7 @@ TEST(ProxyServiceTest, InitialPACScriptDownload) { ProxyInfo info1; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://request1"), &info1, &callback1, NULL); + NULL, GURL("http://request1"), &info1, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); // The first request should have triggered download of PAC script. @@ -922,13 +922,13 @@ TEST(ProxyServiceTest, InitialPACScriptDownload) { ProxyInfo info2; TestCompletionCallback callback2; rv = service.ResolveProxy( - GURL("http://request2"), &info2, &callback2, NULL); + NULL, GURL("http://request2"), &info2, &callback2, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info3; TestCompletionCallback callback3; rv = service.ResolveProxy( - GURL("http://request3"), &info3, &callback3, NULL); + NULL, GURL("http://request3"), &info3, &callback3, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); // Nothing has been sent to the resolver yet. @@ -990,7 +990,7 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) { TestCompletionCallback callback1; ProxyService::PacRequest* request1; int rv = service.ResolveProxy( - GURL("http://request1"), &info1, &callback1, &request1); + NULL, GURL("http://request1"), &info1, &callback1, &request1); EXPECT_EQ(ERR_IO_PENDING, rv); // The first request should have triggered download of PAC script. @@ -1001,13 +1001,13 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) { TestCompletionCallback callback2; ProxyService::PacRequest* request2; rv = service.ResolveProxy( - GURL("http://request2"), &info2, &callback2, &request2); + NULL, GURL("http://request2"), &info2, &callback2, &request2); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info3; TestCompletionCallback callback3; rv = service.ResolveProxy( - GURL("http://request3"), &info3, &callback3, NULL); + NULL, GURL("http://request3"), &info3, &callback3, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); // Nothing has been sent to the resolver yet. @@ -1063,14 +1063,14 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomPac) { ProxyInfo info1; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://request1"), &info1, &callback1, NULL); + NULL, GURL("http://request1"), &info1, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info2; TestCompletionCallback callback2; ProxyService::PacRequest* request2; rv = service.ResolveProxy( - GURL("http://request2"), &info2, &callback2, &request2); + NULL, GURL("http://request2"), &info2, &callback2, &request2); EXPECT_EQ(ERR_IO_PENDING, rv); // Check that nothing has been sent to the proxy resolver yet. @@ -1133,14 +1133,14 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomPac2) { ProxyInfo info1; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://request1"), &info1, &callback1, NULL); + NULL, GURL("http://request1"), &info1, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info2; TestCompletionCallback callback2; ProxyService::PacRequest* request2; rv = service.ResolveProxy( - GURL("http://request2"), &info2, &callback2, &request2); + NULL, GURL("http://request2"), &info2, &callback2, &request2); EXPECT_EQ(ERR_IO_PENDING, rv); // Check that nothing has been sent to the proxy resolver yet. @@ -1208,14 +1208,14 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomToManual) { ProxyInfo info1; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://request1"), &info1, &callback1, NULL); + NULL, GURL("http://request1"), &info1, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info2; TestCompletionCallback callback2; ProxyService::PacRequest* request2; rv = service.ResolveProxy( - GURL("http://request2"), &info2, &callback2, &request2); + NULL, GURL("http://request2"), &info2, &callback2, &request2); EXPECT_EQ(ERR_IO_PENDING, rv); // Check that nothing has been sent to the proxy resolver yet. @@ -1265,7 +1265,7 @@ TEST(ProxyServiceTest, BypassDoesntApplyToPac) { ProxyInfo info1; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://www.google.com"), &info1, &callback1, NULL); + NULL, GURL("http://www.google.com"), &info1, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); // Check that nothing has been sent to the proxy resolver yet. @@ -1296,7 +1296,7 @@ TEST(ProxyServiceTest, BypassDoesntApplyToPac) { ProxyInfo info2; TestCompletionCallback callback2; rv = service.ResolveProxy( - GURL("http://www.google.com"), &info2, &callback2, NULL); + NULL, GURL("http://www.google.com"), &info2, &callback2, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -1321,7 +1321,7 @@ TEST(ProxyServiceTest, ResetProxyConfigService) { ProxyInfo info; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://request1"), &info, &callback1, NULL); + NULL, GURL("http://request1"), &info, &callback1, NULL); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); @@ -1330,7 +1330,8 @@ TEST(ProxyServiceTest, ResetProxyConfigService) { config2.auto_detect = false; service.ResetConfigService(new MockProxyConfigService(config2)); TestCompletionCallback callback2; - rv = service.ResolveProxy(GURL("http://request2"), &info, &callback2, NULL); + rv = service.ResolveProxy( + NULL, GURL("http://request2"), &info, &callback2, NULL); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy2:8080", info.proxy_server().ToURI()); } @@ -1394,7 +1395,7 @@ TEST(ProxyServiceTest, UpdateConfigAfterFailedAutodetect) { ProxyInfo info1; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://www.google.com"), &info1, &callback1, NULL); + NULL, GURL("http://www.google.com"), &info1, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); // Check that nothing has been sent to the proxy resolver yet. @@ -1418,7 +1419,7 @@ TEST(ProxyServiceTest, UpdateConfigAfterFailedAutodetect) { ProxyInfo info2; TestCompletionCallback callback2; rv = service.ResolveProxy( - GURL("http://www.google.com"), &info2, &callback2, NULL); + NULL, GURL("http://www.google.com"), &info2, &callback2, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info2.is_direct()); @@ -1439,7 +1440,7 @@ TEST(ProxyServiceTest, UpdateConfigFromPACToDirect) { ProxyInfo info1; TestCompletionCallback callback1; int rv = service.ResolveProxy( - GURL("http://www.google.com"), &info1, &callback1, NULL); + NULL, GURL("http://www.google.com"), &info1, &callback1, NULL); EXPECT_EQ(ERR_IO_PENDING, rv); // Check that nothing has been sent to the proxy resolver yet. @@ -1471,7 +1472,7 @@ TEST(ProxyServiceTest, UpdateConfigFromPACToDirect) { ProxyInfo info2; TestCompletionCallback callback2; rv = service.ResolveProxy( - GURL("http://www.google.com"), &info2, &callback2, NULL); + NULL, GURL("http://www.google.com"), &info2, &callback2, NULL); EXPECT_EQ(OK, rv); EXPECT_TRUE(info2.is_direct()); |