Chromium Code Reviews| Index: net/socket/socket_test_util.cc |
| diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc |
| index 15c26f8c028cf0bbfe7faabed5c2ac480fae0108..a3c376c38a9fd6a7d12ee46c18c5e914fe271c96 100644 |
| --- a/net/socket/socket_test_util.cc |
| +++ b/net/socket/socket_test_util.cc |
| @@ -201,10 +201,16 @@ const MockWrite& StaticSocketDataHelper::AdvanceWrite() { |
| return writes_[write_index_++]; |
| } |
| +void StaticSocketDataHelper::Reset() { |
| + read_index_ = 0; |
| + write_index_ = 0; |
| +} |
|
mmenke
2016/10/14 14:57:39
If this isn't being used, should be just remove it
davidben
2016/10/14 16:32:37
Seems to be called in initialization. I was just r
mmenke
2016/10/14 16:45:32
Oops, didn't notice that you moved it, as opposed
|
| + |
| bool StaticSocketDataHelper::VerifyWriteData(const std::string& data) { |
| CHECK(!AllWriteDataConsumed()); |
| - // Check that what the actual data matches the expectations. |
| - const MockWrite& next_write = PeekWrite(); |
| + // Check that the actual data matches the expectations, skipping over any |
| + // pause events. |
| + const MockWrite& next_write = PeekRealWrite(); |
| if (!next_write.data) |
| return true; |
| @@ -221,9 +227,14 @@ bool StaticSocketDataHelper::VerifyWriteData(const std::string& data) { |
| return expected_data == actual_data; |
| } |
| -void StaticSocketDataHelper::Reset() { |
| - read_index_ = 0; |
| - write_index_ = 0; |
| +const MockWrite& StaticSocketDataHelper::PeekRealWrite() const { |
| + for (size_t i = write_index_; i < write_count_; i++) { |
| + if (writes_[i].mode != ASYNC || writes_[i].result != ERR_IO_PENDING) |
| + return writes_[i]; |
| + } |
| + |
| + CHECK(0) << "No write data available."; |
|
mmenke
2016/10/14 14:57:39
nit: CHECK(false) is more common.
davidben
2016/10/14 16:32:37
Done. C habits. :-)
|
| + return writes_[0]; // Avoid warning about unreachable missing return. |
| } |
| StaticSocketDataProvider::StaticSocketDataProvider() |