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

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: Rebase. 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 fa47d26fd0f36da03aaedf37b3e0775c6543fc64..56844974bace79f1d316f1c081c495f4749e57ec 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -587,6 +587,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;
@@ -640,6 +642,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;
@@ -677,7 +681,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_;
James Hawkins 2011/12/07 00:01:57 #include "net/base/completion_callback.h"
James Hawkins 2011/12/07 00:08:11 Done.
bool was_used_to_convey_data_;
};
@@ -695,11 +700,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;
@@ -725,7 +732,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_;
};
@@ -743,6 +751,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;
@@ -785,31 +795,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_;
@@ -820,7 +834,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