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

Unified Diff: net/socket/socket_test_util.cc

Issue 1119803006: Revert of Add AllReadDataConsumed and AllWriteDataConsumed methods to SocketDataProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 4df69d2fa1ccfe46bed35f6bf2e6e54d87fe2f47..cf033c245c3e86c8b5c427c2dc061e49172b7a3a 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -156,27 +156,27 @@
}
const MockRead& StaticSocketDataHelper::PeekRead() const {
- CHECK(!AllReadDataConsumed());
+ CHECK(!at_read_eof());
return reads_[read_index_];
}
const MockWrite& StaticSocketDataHelper::PeekWrite() const {
- CHECK(!AllWriteDataConsumed());
+ CHECK(!at_write_eof());
return writes_[write_index_];
}
const MockRead& StaticSocketDataHelper::AdvanceRead() {
- CHECK(!AllReadDataConsumed());
+ CHECK(!at_read_eof());
return reads_[read_index_++];
}
const MockWrite& StaticSocketDataHelper::AdvanceWrite() {
- CHECK(!AllWriteDataConsumed());
+ CHECK(!at_write_eof());
return writes_[write_index_++];
}
bool StaticSocketDataHelper::VerifyWriteData(const std::string& data) {
- CHECK(!AllWriteDataConsumed());
+ CHECK(!at_write_eof());
// Check that what the actual data matches the expectations.
const MockWrite& next_write = PeekWrite();
if (!next_write.data)
@@ -195,14 +195,6 @@
return expected_data == actual_data;
}
-bool StaticSocketDataHelper::AllReadDataConsumed() const {
- return read_index_ >= read_count_;
-}
-
-bool StaticSocketDataHelper::AllWriteDataConsumed() const {
- return write_index_ >= write_count_;
-}
-
void StaticSocketDataHelper::Reset() {
read_index_ = 0;
write_index_ = 0;
@@ -223,7 +215,7 @@
}
MockRead StaticSocketDataProvider::OnRead() {
- CHECK(!helper_.AllReadDataConsumed());
+ CHECK(!helper_.at_read_eof());
return helper_.AdvanceRead();
}
@@ -232,8 +224,8 @@
// Not using mock writes; succeed synchronously.
return MockWriteResult(SYNCHRONOUS, data.length());
}
- EXPECT_FALSE(helper_.AllWriteDataConsumed());
- if (helper_.AllWriteDataConsumed()) {
+ EXPECT_FALSE(helper_.at_write_eof());
+ if (helper_.at_write_eof()) {
// Show what the extra write actually consists of.
EXPECT_EQ("<unexpected write>", data);
return MockWriteResult(SYNCHRONOUS, ERR_UNEXPECTED);
@@ -254,14 +246,6 @@
void StaticSocketDataProvider::Reset() {
helper_.Reset();
-}
-
-bool StaticSocketDataProvider::AllReadDataConsumed() const {
- return helper_.AllReadDataConsumed();
-}
-
-bool StaticSocketDataProvider::AllWriteDataConsumed() const {
- return helper_.AllWriteDataConsumed();
}
DynamicSocketDataProvider::DynamicSocketDataProvider()
@@ -524,7 +508,7 @@
MockRead SequencedSocketData::OnRead() {
CHECK_EQ(IDLE, read_state_);
- CHECK(!helper_.AllReadDataConsumed());
+ CHECK(!helper_.at_read_eof());
NET_TRACE(1, " *** ") << "sequence_number: " << sequence_number_;
const MockRead& next_read = helper_.PeekRead();
@@ -536,7 +520,7 @@
NET_TRACE(1, " *** ") << "Hanging read";
helper_.AdvanceRead();
++sequence_number_;
- CHECK(helper_.AllReadDataConsumed());
+ CHECK(helper_.at_read_eof());
return MockRead(SYNCHRONOUS, ERR_IO_PENDING);
}
@@ -568,7 +552,7 @@
MockWriteResult SequencedSocketData::OnWrite(const std::string& data) {
CHECK_EQ(IDLE, write_state_);
- CHECK(!helper_.AllWriteDataConsumed());
+ CHECK(!helper_.at_write_eof());
NET_TRACE(1, " *** ") << "sequence_number: " << sequence_number_;
const MockWrite& next_write = helper_.PeekWrite();
@@ -616,12 +600,12 @@
weak_factory_.InvalidateWeakPtrs();
}
-bool SequencedSocketData::AllReadDataConsumed() const {
- return helper_.AllReadDataConsumed();
-}
-
-bool SequencedSocketData::AllWriteDataConsumed() const {
- return helper_.AllWriteDataConsumed();
+bool SequencedSocketData::at_read_eof() const {
+ return helper_.at_read_eof();
+}
+
+bool SequencedSocketData::at_write_eof() const {
+ return helper_.at_read_eof();
}
void SequencedSocketData::MaybePostReadCompleteTask() {
@@ -741,7 +725,7 @@
// 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 ((!AllWriteDataConsumed() || !AllReadDataConsumed()) && !stopped()) {
+ while ((!at_write_eof() || !at_read_eof()) && !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