Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: net/proxy/mock_proxy_resolver.cc

Issue 1157163003: Remove ProxyResolver::(Cancel)SetPacScript and LegacyProxyResolverFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-proxy-resolver-refactor
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/mock_proxy_resolver.h ('k') | net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/mock_proxy_resolver.cc
diff --git a/net/proxy/mock_proxy_resolver.cc b/net/proxy/mock_proxy_resolver.cc
index 06a890b5451a68874cf87f2a9d289e551419d18f..9c5cb036107e782f48372d596cebbb036f155fe1 100644
--- a/net/proxy/mock_proxy_resolver.cc
+++ b/net/proxy/mock_proxy_resolver.cc
@@ -9,18 +9,18 @@
namespace net {
-MockAsyncProxyResolverBase::Request::Request(
- MockAsyncProxyResolverBase* resolver,
- const GURL& url,
- ProxyInfo* results,
- const CompletionCallback& callback)
+MockAsyncProxyResolver::Request::Request(MockAsyncProxyResolver* resolver,
+ const GURL& url,
+ ProxyInfo* results,
+ const CompletionCallback& callback)
: resolver_(resolver),
url_(url),
results_(results),
callback_(callback),
- origin_loop_(base::MessageLoop::current()) {}
+ origin_loop_(base::MessageLoop::current()) {
+}
- void MockAsyncProxyResolverBase::Request::CompleteNow(int rv) {
+void MockAsyncProxyResolver::Request::CompleteNow(int rv) {
CompletionCallback callback = callback_;
// May delete |this|.
@@ -29,33 +29,18 @@ MockAsyncProxyResolverBase::Request::Request(
callback.Run(rv);
}
-MockAsyncProxyResolverBase::Request::~Request() {}
-
-MockAsyncProxyResolverBase::SetPacScriptRequest::SetPacScriptRequest(
- MockAsyncProxyResolverBase* resolver,
- const scoped_refptr<ProxyResolverScriptData>& script_data,
- const CompletionCallback& callback)
- : resolver_(resolver),
- script_data_(script_data),
- callback_(callback),
- origin_loop_(base::MessageLoop::current()) {}
-
-MockAsyncProxyResolverBase::SetPacScriptRequest::~SetPacScriptRequest() {}
-
- void MockAsyncProxyResolverBase::SetPacScriptRequest::CompleteNow(int rv) {
- CompletionCallback callback = callback_;
-
- // Will delete |this|.
- resolver_->RemovePendingSetPacScriptRequest(this);
-
- callback.Run(rv);
+ MockAsyncProxyResolver::Request::~Request() {
}
-MockAsyncProxyResolverBase::~MockAsyncProxyResolverBase() {}
+ MockAsyncProxyResolver::~MockAsyncProxyResolver() {
+ }
-int MockAsyncProxyResolverBase::GetProxyForURL(
- const GURL& url, ProxyInfo* results, const CompletionCallback& callback,
- RequestHandle* request_handle, const BoundNetLog& /*net_log*/) {
+ int MockAsyncProxyResolver::GetProxyForURL(
+ const GURL& url,
+ ProxyInfo* results,
+ const CompletionCallback& callback,
+ RequestHandle* request_handle,
+ const BoundNetLog& /*net_log*/) {
scoped_refptr<Request> request = new Request(this, url, results, callback);
pending_requests_.push_back(request);
@@ -66,52 +51,27 @@ int MockAsyncProxyResolverBase::GetProxyForURL(
return ERR_IO_PENDING;
}
-void MockAsyncProxyResolverBase::CancelRequest(RequestHandle request_handle) {
+void MockAsyncProxyResolver::CancelRequest(RequestHandle request_handle) {
scoped_refptr<Request> request = reinterpret_cast<Request*>(request_handle);
cancelled_requests_.push_back(request);
RemovePendingRequest(request.get());
}
-LoadState MockAsyncProxyResolverBase::GetLoadState(
+LoadState MockAsyncProxyResolver::GetLoadState(
RequestHandle request_handle) const {
return LOAD_STATE_RESOLVING_PROXY_FOR_URL;
}
-int MockAsyncProxyResolverBase::SetPacScript(
- const scoped_refptr<ProxyResolverScriptData>& script_data,
- const CompletionCallback& callback) {
- DCHECK(!pending_set_pac_script_request_.get());
- pending_set_pac_script_request_.reset(
- new SetPacScriptRequest(this, script_data, callback));
- // Finished when user calls SetPacScriptRequest::CompleteNow().
- return ERR_IO_PENDING;
-}
-
-void MockAsyncProxyResolverBase::CancelSetPacScript() {
- // Do nothing (caller was responsible for completing the request).
-}
-
-MockAsyncProxyResolverBase::SetPacScriptRequest*
-MockAsyncProxyResolverBase::pending_set_pac_script_request() const {
- return pending_set_pac_script_request_.get();
-}
-
-void MockAsyncProxyResolverBase::RemovePendingRequest(Request* request) {
+void MockAsyncProxyResolver::RemovePendingRequest(Request* request) {
RequestsList::iterator it = std::find(
pending_requests_.begin(), pending_requests_.end(), request);
DCHECK(it != pending_requests_.end());
pending_requests_.erase(it);
}
-void MockAsyncProxyResolverBase::RemovePendingSetPacScriptRequest(
- SetPacScriptRequest* request) {
- DCHECK_EQ(request, pending_set_pac_script_request());
- pending_set_pac_script_request_.reset();
+MockAsyncProxyResolver::MockAsyncProxyResolver() {
}
-MockAsyncProxyResolverBase::MockAsyncProxyResolverBase(bool expects_pac_bytes)
- : ProxyResolver(expects_pac_bytes) {}
-
MockAsyncProxyResolverFactory::Request::Request(
MockAsyncProxyResolverFactory* factory,
const scoped_refptr<ProxyResolverScriptData>& script_data,
@@ -200,7 +160,7 @@ MockAsyncProxyResolverFactory::~MockAsyncProxyResolverFactory() {
}
ForwardingProxyResolver::ForwardingProxyResolver(ProxyResolver* impl)
- : ProxyResolver(impl->expects_pac_bytes()), impl_(impl) {
+ : impl_(impl) {
}
int ForwardingProxyResolver::GetProxyForURL(const GURL& query_url,
@@ -219,14 +179,4 @@ LoadState ForwardingProxyResolver::GetLoadState(RequestHandle request) const {
return impl_->GetLoadState(request);
}
-void ForwardingProxyResolver::CancelSetPacScript() {
- impl_->CancelSetPacScript();
-}
-
-int ForwardingProxyResolver::SetPacScript(
- const scoped_refptr<ProxyResolverScriptData>& script_data,
- const CompletionCallback& callback) {
- return impl_->SetPacScript(script_data, callback);
-}
-
} // namespace net
« no previous file with comments | « net/proxy/mock_proxy_resolver.h ('k') | net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698