Chromium Code Reviews| 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..29f67de0c55c2ece0fe4e0eba750f0299a07f977 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 |
|
asanka
2015/12/03 17:41:56
*event
mmenke
2015/12/03 18:24:23
Done.
|
| + // 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) { |
| + 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; |
|
mmenke
2015/12/03 16:15:34
See comment in the unittest file for why I added t
|
| bool WasEverUsed() const override; |
| bool UsingTCPFastOpen() const override; |
| int GetPeerAddress(IPEndPoint* address) const override; |