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

Unified Diff: net/socket/socket_test_util.h

Issue 8801005: base::Bind: Convert Socket::Read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: net/socket/socket_test_util.h
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index b7c7df26f548e16571cf215e7f699459e2a473db..ad590f84c4af58a1f79d8380b7c68139c75b229b 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -586,6 +586,8 @@ class MockClientSocket : public net::SSLClientSocket {
// Socket implementation.
virtual int Read(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) = 0;
+ virtual int Read(net::IOBuffer* buf, int buf_len,
+ const net::CompletionCallback& callback) = 0;
virtual int Write(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) = 0;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
@@ -638,6 +640,8 @@ class MockTCPClientSocket : public MockClientSocket, public AsyncSocket {
// Socket implementation.
virtual int Read(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) OVERRIDE;
+ virtual int Read(net::IOBuffer* buf, int buf_len,
+ const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) OVERRIDE;
@@ -675,7 +679,8 @@ class MockTCPClientSocket : public MockClientSocket, public AsyncSocket {
// While an asynchronous IO is pending, we save our user-buffer state.
net::IOBuffer* pending_buf_;
int pending_buf_len_;
- net::OldCompletionCallback* pending_callback_;
+ net::OldCompletionCallback* old_pending_callback_;
+ net::CompletionCallback pending_callback_;
bool was_used_to_convey_data_;
};
@@ -693,11 +698,13 @@ class DeterministicMockTCPClientSocket : public MockClientSocket,
void CompleteWrite();
int CompleteRead();
- // Socket:
+ // Socket implementation.
virtual int Write(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) OVERRIDE;
virtual int Read(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) OVERRIDE;
+ virtual int Read(net::IOBuffer* buf, int buf_len,
+ const net::CompletionCallback& callback) OVERRIDE;
// StreamSocket implementation.
virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE;
@@ -723,7 +730,8 @@ class DeterministicMockTCPClientSocket : public MockClientSocket,
net::IOBuffer* read_buf_;
int read_buf_len_;
bool read_pending_;
- net::OldCompletionCallback* read_callback_;
+ net::OldCompletionCallback* old_read_callback_;
+ net::CompletionCallback read_callback_;
net::DeterministicSocketData* data_;
bool was_used_to_convey_data_;
};
@@ -741,6 +749,8 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket {
// Socket implementation.
virtual int Read(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) OVERRIDE;
+ virtual int Read(net::IOBuffer* buf, int buf_len,
+ const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) OVERRIDE;
@@ -782,31 +792,35 @@ class MockUDPClientSocket : public DatagramClientSocket,
MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log);
virtual ~MockUDPClientSocket();
- // Socket interface
+ // Socket implementation.
virtual int Read(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) OVERRIDE;
+ virtual int Read(net::IOBuffer* buf, int buf_len,
+ const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
net::OldCompletionCallback* callback) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
- // DatagramSocket interface
+ // DatagramSocket implementation.
virtual void Close() OVERRIDE;
virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE;
virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
virtual const BoundNetLog& NetLog() const OVERRIDE;
- // DatagramClientSocket interface
+ // DatagramClientSocket implementation.
virtual int Connect(const IPEndPoint& address) OVERRIDE;
- // AsyncSocket interface
+ // AsyncSocket implementation.
virtual void OnReadComplete(const MockRead& data) OVERRIDE;
private:
int CompleteRead();
void RunCallbackAsync(net::OldCompletionCallback* callback, int result);
- void RunCallback(net::OldCompletionCallback* callback, int result);
+ void RunCallbackAsync(const net::CompletionCallback& callback, int result);
+ void RunOldCallback(net::OldCompletionCallback* callback, int result);
+ void RunCallback(const net::CompletionCallback& callback, int result);
bool connected_;
SocketDataProvider* data_;
@@ -817,7 +831,8 @@ class MockUDPClientSocket : public DatagramClientSocket,
// While an asynchronous IO is pending, we save our user-buffer state.
net::IOBuffer* pending_buf_;
int pending_buf_len_;
- net::OldCompletionCallback* pending_callback_;
+ net::OldCompletionCallback* old_pending_callback_;
+ net::CompletionCallback pending_callback_;
BoundNetLog net_log_;

Powered by Google App Engine
This is Rietveld 408576698