Index: net/socket/socket_test_util.h |
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h |
index 430b5225331c4eaaefdf1cbe413c411d0b44268c..5a0b7e67f2f44aff88ec1b8bd06fad5d9c1c9e46 100644 |
--- a/net/socket/socket_test_util.h |
+++ b/net/socket/socket_test_util.h |
@@ -204,6 +204,10 @@ class SocketDataProvider { |
virtual bool AllReadDataConsumed() const = 0; |
virtual bool AllWriteDataConsumed() const = 0; |
+ // Returns true if the request should be considered idle, for the purposes of |
+ // IsConnectedAndIdle. |
+ virtual bool IsIdle() const; |
+ |
// Accessor for the socket which is using the SocketDataProvider. |
AsyncSocket* socket() { return socket_; } |
void set_socket(AsyncSocket* socket) { socket_ = socket; } |
@@ -364,10 +368,18 @@ class SequencedSocketData : public SocketDataProvider { |
void Reset() override; |
bool AllReadDataConsumed() const override; |
bool AllWriteDataConsumed() const override; |
+ bool IsIdle() const override; |
bool IsReadPaused(); |
void CompleteRead(); |
+ // When true, IsConnectedAndIdle() will return false if the next even in the |
+ // sequence is a synchronous. Otherwise, the socket claims to be idle as |
+ // long as it's connected. Defaults to false. |
+ void set_busy_before_sync_reads(bool busy_before_sync_reads) { |
asanka
2015/12/03 17:41:57
Perhaps not for this CL, but shouldn't this always
mmenke
2015/12/03 18:24:23
I was worried about breaking all existing synchron
|
+ busy_before_sync_reads_ = busy_before_sync_reads; |
+ } |
+ |
private: |
// Defines the state for the read or write path. |
enum IoState { |
@@ -389,6 +401,8 @@ class SequencedSocketData : public SocketDataProvider { |
IoState read_state_; |
IoState write_state_; |
+ bool busy_before_sync_reads_; |
+ |
base::WeakPtrFactory<SequencedSocketData> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(SequencedSocketData); |
@@ -898,6 +912,7 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { |
int Connect(const CompletionCallback& callback) override; |
void Disconnect() override; |
bool IsConnected() const override; |
+ bool IsConnectedAndIdle() const override; |
bool WasEverUsed() const override; |
bool UsingTCPFastOpen() const override; |
int GetPeerAddress(IPEndPoint* address) const override; |