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

Unified Diff: net/socket/socket_test_util.h

Issue 389007: After draining the body of a 401/407 response, verify that... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Improve comments Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_test_util.h
===================================================================
--- net/socket/socket_test_util.h (revision 31823)
+++ net/socket/socket_test_util.h (working copy)
@@ -25,6 +25,15 @@
namespace net {
+enum {
+ // A private network error code used by the socket test utility classes.
+ // If the |result| member of a MockRead is
+ // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a
+ // marker that indicates the peer will close the connection after the next
+ // MockRead. The other members of that MockRead are ignored.
+ ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000,
+};
+
class ClientSocket;
class LoadLog;
class MockClientSocket;
@@ -285,6 +294,8 @@
void RunCallback(net::CompletionCallback*, int result);
ScopedRunnableMethodFactory<MockClientSocket> method_factory_;
+
+ // True if Connect completed successfully and Disconnect hasn't been called.
bool connected_;
};
@@ -296,6 +307,8 @@
// ClientSocket methods:
virtual int Connect(net::CompletionCallback* callback,
LoadLog* load_log);
+ virtual bool IsConnected() const;
+ virtual bool IsConnectedAndIdle() const { return IsConnected(); }
// Socket methods:
virtual int Read(net::IOBuffer* buf, int buf_len,
@@ -317,6 +330,11 @@
net::MockRead read_data_;
bool need_read_data_;
+ // True if the peer has closed the connection. This allows us to simulate
+ // the recv(..., MSG_PEEK) call in the IsConnectedAndIdle method of the real
+ // TCPClientSocket.
+ bool peer_closed_connection_;
+
// While an asynchronous IO is pending, we save our user-buffer state.
net::IOBuffer* pending_buf_;
int pending_buf_len_;
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698