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

Unified Diff: net/socket/socket_test_util.cc

Issue 1123393005: Remove redundant at_read_eof and at_write_eof methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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/socket/socket_test_util.h ('k') | net/spdy/spdy_http_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_test_util.cc
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index 9e50800e26a2347a78ddfa4b9bc0e4a85eaf197a..c1c91c56c0d2d3f8b0ed5c9803790af1ef8497c0 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -157,27 +157,27 @@ StaticSocketDataHelper::~StaticSocketDataHelper() {
}
const MockRead& StaticSocketDataHelper::PeekRead() const {
- CHECK(!at_read_eof());
+ CHECK(!AllReadDataConsumed());
return reads_[read_index_];
}
const MockWrite& StaticSocketDataHelper::PeekWrite() const {
- CHECK(!at_write_eof());
+ CHECK(!AllWriteDataConsumed());
return writes_[write_index_];
}
const MockRead& StaticSocketDataHelper::AdvanceRead() {
- CHECK(!at_read_eof());
+ CHECK(!AllReadDataConsumed());
return reads_[read_index_++];
}
const MockWrite& StaticSocketDataHelper::AdvanceWrite() {
- CHECK(!at_write_eof());
+ CHECK(!AllWriteDataConsumed());
return writes_[write_index_++];
}
bool StaticSocketDataHelper::VerifyWriteData(const std::string& data) {
- CHECK(!at_write_eof());
+ CHECK(!AllWriteDataConsumed());
// Check that what the actual data matches the expectations.
const MockWrite& next_write = PeekWrite();
if (!next_write.data)
@@ -216,7 +216,7 @@ StaticSocketDataProvider::~StaticSocketDataProvider() {
}
MockRead StaticSocketDataProvider::OnRead() {
- CHECK(!helper_.at_read_eof());
+ CHECK(!helper_.AllReadDataConsumed());
return helper_.AdvanceRead();
}
@@ -225,8 +225,8 @@ MockWriteResult StaticSocketDataProvider::OnWrite(const std::string& data) {
// Not using mock writes; succeed synchronously.
return MockWriteResult(SYNCHRONOUS, data.length());
}
- EXPECT_FALSE(helper_.at_write_eof());
- if (helper_.at_write_eof()) {
+ EXPECT_FALSE(helper_.AllWriteDataConsumed());
+ if (helper_.AllWriteDataConsumed()) {
// Show what the extra write actually consists of.
EXPECT_EQ("<unexpected write>", data);
return MockWriteResult(SYNCHRONOUS, ERR_UNEXPECTED);
@@ -250,11 +250,11 @@ void StaticSocketDataProvider::Reset() {
}
bool StaticSocketDataProvider::AllReadDataConsumed() const {
- return helper_.at_read_eof();
+ return helper_.AllReadDataConsumed();
}
bool StaticSocketDataProvider::AllWriteDataConsumed() const {
- return helper_.at_write_eof();
+ return helper_.AllWriteDataConsumed();
}
DynamicSocketDataProvider::DynamicSocketDataProvider()
@@ -358,7 +358,7 @@ SequencedSocketData::SequencedSocketData(const MockConnect& connect,
MockRead SequencedSocketData::OnRead() {
CHECK_EQ(IDLE, read_state_);
- CHECK(!helper_.at_read_eof());
+ CHECK(!helper_.AllReadDataConsumed());
NET_TRACE(1, " *** ") << "sequence_number: " << sequence_number_;
const MockRead& next_read = helper_.PeekRead();
@@ -402,7 +402,7 @@ MockRead SequencedSocketData::OnRead() {
MockWriteResult SequencedSocketData::OnWrite(const std::string& data) {
CHECK_EQ(IDLE, write_state_);
- CHECK(!helper_.at_write_eof());
+ CHECK(!helper_.AllWriteDataConsumed());
NET_TRACE(1, " *** ") << "sequence_number: " << sequence_number_;
const MockWrite& next_write = helper_.PeekWrite();
@@ -451,19 +451,11 @@ void SequencedSocketData::Reset() {
}
bool SequencedSocketData::AllReadDataConsumed() const {
- return helper_.at_read_eof();
+ return helper_.AllReadDataConsumed();
}
bool SequencedSocketData::AllWriteDataConsumed() const {
- return helper_.at_write_eof();
-}
-
-bool SequencedSocketData::at_read_eof() const {
- return helper_.at_read_eof();
-}
-
-bool SequencedSocketData::at_write_eof() const {
- return helper_.at_read_eof();
+ return helper_.AllWriteDataConsumed();
}
bool SequencedSocketData::IsReadPaused() {
@@ -610,7 +602,7 @@ void DeterministicSocketData::Run() {
// the tasks in the message loop, and explicitly invoking the read/write
// callbacks (simulating network I/O). We check our conditions between each,
// since they can change in either.
- while ((!at_write_eof() || !at_read_eof()) && !stopped()) {
+ while ((!AllWriteDataConsumed() || !AllReadDataConsumed()) && !stopped()) {
if (counter % 2 == 0)
base::RunLoop().RunUntilIdle();
if (counter % 2 == 1) {
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/spdy/spdy_http_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698