| Index: net/socket/socket_test_util.cc
 | 
| diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
 | 
| index 93fcf3d7bd053489980ab129072216a3893c9d96..bd3bdedbe136fdd684f563e2449ffbc89d2e519d 100644
 | 
| --- a/net/socket/socket_test_util.cc
 | 
| +++ b/net/socket/socket_test_util.cc
 | 
| @@ -143,6 +143,10 @@ MockConnect::MockConnect(IoMode io_mode, int r, IPEndPoint addr) :
 | 
|  
 | 
|  MockConnect::~MockConnect() {}
 | 
|  
 | 
| +bool SocketDataProvider::IsIdle() const {
 | 
| +  return true;
 | 
| +}
 | 
| +
 | 
|  StaticSocketDataHelper::StaticSocketDataHelper(MockRead* reads,
 | 
|                                                 size_t reads_count,
 | 
|                                                 MockWrite* writes,
 | 
| @@ -288,6 +292,7 @@ SequencedSocketData::SequencedSocketData(MockRead* reads,
 | 
|        sequence_number_(0),
 | 
|        read_state_(IDLE),
 | 
|        write_state_(IDLE),
 | 
| +      busy_before_sync_reads_(false),
 | 
|        weak_factory_(this) {
 | 
|    // Check that reads and writes have a contiguous set of sequence numbers
 | 
|    // starting from 0 and working their way up, with no repeats and skipping
 | 
| @@ -427,6 +432,20 @@ bool SequencedSocketData::AllWriteDataConsumed() const {
 | 
|    return helper_.AllWriteDataConsumed();
 | 
|  }
 | 
|  
 | 
| +bool SequencedSocketData::IsIdle() const {
 | 
| +  // If |busy_before_sync_reads_| is not set, always considered idle.  If
 | 
| +  // no reads left, or the next operation is a write, also consider it idle.
 | 
| +  if (!busy_before_sync_reads_ || helper_.AllReadDataConsumed() ||
 | 
| +      helper_.PeekRead().sequence_number != sequence_number_) {
 | 
| +    return true;
 | 
| +  }
 | 
| +
 | 
| +  // If the next operation is synchronous read, treat the socket as not idle.
 | 
| +  if (helper_.PeekRead().mode == SYNCHRONOUS)
 | 
| +    return false;
 | 
| +  return true;
 | 
| +}
 | 
| +
 | 
|  bool SequencedSocketData::IsReadPaused() {
 | 
|    return read_state_ == PAUSED;
 | 
|  }
 | 
| @@ -1059,7 +1078,7 @@ bool MockTCPClientSocket::IsConnected() const {
 | 
|  }
 | 
|  
 | 
|  bool MockTCPClientSocket::IsConnectedAndIdle() const {
 | 
| -  return IsConnected();
 | 
| +  return IsConnected() && data_->IsIdle();
 | 
|  }
 | 
|  
 | 
|  int MockTCPClientSocket::GetPeerAddress(IPEndPoint* address) const {
 | 
| @@ -1503,6 +1522,10 @@ bool MockSSLClientSocket::IsConnected() const {
 | 
|    return transport_->socket()->IsConnected();
 | 
|  }
 | 
|  
 | 
| +bool MockSSLClientSocket::IsConnectedAndIdle() const {
 | 
| +  return transport_->socket()->IsConnectedAndIdle();
 | 
| +}
 | 
| +
 | 
|  bool MockSSLClientSocket::WasEverUsed() const {
 | 
|    return transport_->socket()->WasEverUsed();
 | 
|  }
 | 
| 
 |