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

Side by Side Diff: net/proxy/sync_host_resolver_bridge_unittest.cc

Issue 8549004: base::Bind: Convert HostResolver::Resolve. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/sync_host_resolver_bridge.h" 5 #include "net/proxy/sync_host_resolver_bridge.h"
6 6
7 #include "base/threading/thread.h" 7 #include "base/threading/thread.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "net/base/address_list.h" 9 #include "net/base/address_list.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 14 matching lines...) Expand all
25 // has been received. The resolve requests it receives will never be completed. 25 // has been received. The resolve requests it receives will never be completed.
26 class BlockableHostResolver : public HostResolver { 26 class BlockableHostResolver : public HostResolver {
27 public: 27 public:
28 BlockableHostResolver() 28 BlockableHostResolver()
29 : event_(true, false), 29 : event_(true, false),
30 was_request_cancelled_(false) { 30 was_request_cancelled_(false) {
31 } 31 }
32 32
33 virtual int Resolve(const RequestInfo& info, 33 virtual int Resolve(const RequestInfo& info,
34 AddressList* addresses, 34 AddressList* addresses,
35 OldCompletionCallback* callback, 35 const CompletionCallback& callback,
36 RequestHandle* out_req, 36 RequestHandle* out_req,
37 const BoundNetLog& net_log) OVERRIDE { 37 const BoundNetLog& net_log) OVERRIDE {
38 EXPECT_TRUE(callback); 38 EXPECT_FALSE(callback.is_null());
39 EXPECT_TRUE(out_req); 39 EXPECT_TRUE(out_req);
40 *out_req = reinterpret_cast<RequestHandle*>(1); // Magic value. 40 *out_req = reinterpret_cast<RequestHandle*>(1); // Magic value.
41 41
42 // Indicate to the caller that a request was received. 42 // Indicate to the caller that a request was received.
43 event_.Signal(); 43 event_.Signal();
44 44
45 // We return ERR_IO_PENDING, as this request will NEVER be completed. 45 // We return ERR_IO_PENDING, as this request will NEVER be completed.
46 // Expectation is for the caller to later cancel the request. 46 // Expectation is for the caller to later cancel the request.
47 return ERR_IO_PENDING; 47 return ERR_IO_PENDING;
48 } 48 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // stop the IOThread, which will in turn delete the 242 // stop the IOThread, which will in turn delete the
243 // SingleThreadedProxyResolver, which in turn will stop its internal 243 // SingleThreadedProxyResolver, which in turn will stop its internal
244 // PAC thread (which is currently blocked waiting on the host resolve which 244 // PAC thread (which is currently blocked waiting on the host resolve which
245 // is running on IOThread). The IOThread::Cleanup() will verify that after 245 // is running on IOThread). The IOThread::Cleanup() will verify that after
246 // the PAC thread is stopped, it cancels the request on the HostResolver. 246 // the PAC thread is stopped, it cancels the request on the HostResolver.
247 } 247 }
248 248
249 } // namespace 249 } // namespace
250 250
251 } // namespace net 251 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698