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

Unified Diff: net/socket/transport_client_socket_pool_unittest.cc

Issue 8824006: Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years 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/socket/transport_client_socket_pool.cc ('k') | net/socket/transport_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/transport_client_socket_pool_unittest.cc
diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc
index 56b1fa9c9554701757017487f09fa9546bf0f21c..c5d108084690805dc036e4c26a4f6896328976cc 100644
--- a/net/socket/transport_client_socket_pool_unittest.cc
+++ b/net/socket/transport_client_socket_pool_unittest.cc
@@ -52,10 +52,6 @@ class MockClientSocket : public StreamSocket {
addrlist_(addrlist) {}
// StreamSocket implementation.
- virtual int Connect(OldCompletionCallback* callback) {
- connected_ = true;
- return OK;
- }
virtual int Connect(const CompletionCallback& callback) {
connected_ = true;
return OK;
@@ -96,15 +92,11 @@ class MockClientSocket : public StreamSocket {
// Socket implementation.
virtual int Read(IOBuffer* buf, int buf_len,
- OldCompletionCallback* callback) {
- return ERR_FAILED;
- }
- virtual int Read(IOBuffer* buf, int buf_len,
const CompletionCallback& callback) {
return ERR_FAILED;
}
virtual int Write(IOBuffer* buf, int buf_len,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return ERR_FAILED;
}
virtual bool SetReceiveBufferSize(int32 size) { return true; }
@@ -121,10 +113,7 @@ class MockFailingClientSocket : public StreamSocket {
MockFailingClientSocket(const AddressList& addrlist) : addrlist_(addrlist) {}
// StreamSocket implementation.
- virtual int Connect(OldCompletionCallback* callback) {
- return ERR_CONNECTION_FAILED;
- }
- virtual int Connect(const net::CompletionCallback& callback) {
+ virtual int Connect(const CompletionCallback& callback) {
return ERR_CONNECTION_FAILED;
}
@@ -157,16 +146,12 @@ class MockFailingClientSocket : public StreamSocket {
// Socket implementation.
virtual int Read(IOBuffer* buf, int buf_len,
- OldCompletionCallback* callback) {
- return ERR_FAILED;
- }
- virtual int Read(IOBuffer* buf, int buf_len,
const CompletionCallback& callback) {
return ERR_FAILED;
}
virtual int Write(IOBuffer* buf, int buf_len,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return ERR_FAILED;
}
virtual bool SetReceiveBufferSize(int32 size) { return true; }
@@ -196,14 +181,6 @@ class MockPendingClientSocket : public StreamSocket {
addrlist_(addrlist) {}
// StreamSocket implementation.
- virtual int Connect(OldCompletionCallback* callback) {
- MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&MockPendingClientSocket::DoOldCallback,
- weak_factory_.GetWeakPtr(), callback),
- delay_ms_);
- return ERR_IO_PENDING;
- }
virtual int Connect(const CompletionCallback& callback) {
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
@@ -248,34 +225,18 @@ class MockPendingClientSocket : public StreamSocket {
// Socket implementation.
virtual int Read(IOBuffer* buf, int buf_len,
- OldCompletionCallback* callback) {
- return ERR_FAILED;
- }
- virtual int Read(IOBuffer* buf, int buf_len,
const CompletionCallback& callback) {
return ERR_FAILED;
}
virtual int Write(IOBuffer* buf, int buf_len,
- OldCompletionCallback* callback) {
+ const CompletionCallback& callback) {
return ERR_FAILED;
}
virtual bool SetReceiveBufferSize(int32 size) { return true; }
virtual bool SetSendBufferSize(int32 size) { return true; }
private:
- void DoOldCallback(OldCompletionCallback* callback) {
- if (should_stall_)
- return;
-
- if (should_connect_) {
- is_connected_ = true;
- callback->Run(OK);
- } else {
- is_connected_ = false;
- callback->Run(ERR_CONNECTION_FAILED);
- }
- }
void DoCallback(const CompletionCallback& callback) {
if (should_stall_)
return;
« no previous file with comments | « net/socket/transport_client_socket_pool.cc ('k') | net/socket/transport_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698