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

Unified Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 1114383003: 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
Index: net/spdy/spdy_network_transaction_unittest.cc
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 5c90944eda00edb3d24237416b2c523a82726471..3c2073cfec610c66fbcb777871c978946eadfe69 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -270,14 +270,12 @@ class SpdyNetworkTransactionTest
void VerifyDataConsumed() {
for (DataVector::iterator it = data_vector_.begin();
it != data_vector_.end(); ++it) {
- EXPECT_TRUE((*it)->at_read_eof()) << "Read count: "
- << (*it)->read_count()
- << " Read index: "
- << (*it)->read_index();
- EXPECT_TRUE((*it)->at_write_eof()) << "Write count: "
- << (*it)->write_count()
- << " Write index: "
- << (*it)->write_index();
+ EXPECT_TRUE((*it)->AllReadDataConsumed())
+ << "Read count: " << (*it)->read_count()
+ << " Read index: " << (*it)->read_index();
+ EXPECT_TRUE((*it)->AllWriteDataConsumed())
+ << "Write count: " << (*it)->write_count()
+ << " Write index: " << (*it)->write_index();
}
}
@@ -287,14 +285,12 @@ class SpdyNetworkTransactionTest
void VerifyDataNotConsumed() {
for (DataVector::iterator it = data_vector_.begin();
it != data_vector_.end(); ++it) {
- EXPECT_TRUE(!(*it)->at_read_eof()) << "Read count: "
- << (*it)->read_count()
- << " Read index: "
- << (*it)->read_index();
- EXPECT_TRUE(!(*it)->at_write_eof()) << "Write count: "
- << (*it)->write_count()
- << " Write index: "
- << (*it)->write_index();
+ EXPECT_TRUE(!(*it)->AllReadDataConsumed())
+ << "Read count: " << (*it)->read_count()
+ << " Read index: " << (*it)->read_index();
+ EXPECT_TRUE(!(*it)->AllWriteDataConsumed())
+ << "Write count: " << (*it)->write_count()
+ << " Write index: " << (*it)->write_index();
}
}
@@ -647,8 +643,8 @@ class SpdyNetworkTransactionTest
ReadResult(trans, data, &result);
// Verify that we consumed all test data.
- EXPECT_TRUE(data->at_read_eof());
- EXPECT_TRUE(data->at_write_eof());
+ EXPECT_TRUE(data->AllReadDataConsumed());
+ EXPECT_TRUE(data->AllWriteDataConsumed());
// Verify that the received push data is same as the expected push data.
EXPECT_EQ(result2.compare(expected), 0) << "Received data: "
@@ -2488,10 +2484,10 @@ TEST_P(SpdyNetworkTransactionTest, DISABLED_RedirectGetRequest) {
std::string contents("hello!");
EXPECT_EQ(contents, d.data_received());
}
- EXPECT_TRUE(data.at_read_eof());
- EXPECT_TRUE(data.at_write_eof());
- EXPECT_TRUE(data2.at_read_eof());
- EXPECT_TRUE(data2.at_write_eof());
+ EXPECT_TRUE(data.AllReadDataConsumed());
+ EXPECT_TRUE(data.AllWriteDataConsumed());
+ EXPECT_TRUE(data2.AllReadDataConsumed());
+ EXPECT_TRUE(data2.AllWriteDataConsumed());
}
// Send a spdy request to www.example.org. Get a pushed stream that redirects to
@@ -2583,10 +2579,10 @@ TEST_P(SpdyNetworkTransactionTest, DISABLED_RedirectServerPush) {
}
data.CompleteRead();
data2.CompleteRead();
- EXPECT_TRUE(data.at_read_eof());
- EXPECT_TRUE(data.at_write_eof());
- EXPECT_TRUE(data2.at_read_eof());
- EXPECT_TRUE(data2.at_write_eof());
+ EXPECT_TRUE(data.AllReadDataConsumed());
+ EXPECT_TRUE(data.AllWriteDataConsumed());
+ EXPECT_TRUE(data2.AllReadDataConsumed());
+ EXPECT_TRUE(data2.AllWriteDataConsumed());
}
TEST_P(SpdyNetworkTransactionTest, ServerPushSingleDataFrame) {
@@ -2761,14 +2757,12 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushServerAborted) {
EXPECT_EQ(OK, rv);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof()) << "Read count: "
- << data.read_count()
- << " Read index: "
- << data.read_index();
- EXPECT_TRUE(data.at_write_eof()) << "Write count: "
- << data.write_count()
- << " Write index: "
- << data.write_index();
+ EXPECT_TRUE(data.AllReadDataConsumed())
+ << "Read count: " << data.read_count()
+ << " Read index: " << data.read_index();
+ EXPECT_TRUE(data.AllWriteDataConsumed())
+ << "Write count: " << data.write_count()
+ << " Write index: " << data.write_index();
// Verify the SYN_REPLY.
HttpResponseInfo response = *trans->GetResponseInfo();
@@ -2986,14 +2980,12 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID0) {
EXPECT_EQ(OK, rv);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof()) << "Read count: "
- << data.read_count()
- << " Read index: "
- << data.read_index();
- EXPECT_TRUE(data.at_write_eof()) << "Write count: "
- << data.write_count()
- << " Write index: "
- << data.write_index();
+ EXPECT_TRUE(data.AllReadDataConsumed())
+ << "Read count: " << data.read_count()
+ << " Read index: " << data.read_index();
+ EXPECT_TRUE(data.AllWriteDataConsumed())
+ << "Write count: " << data.write_count()
+ << " Write index: " << data.write_index();
// Verify the SYN_REPLY.
HttpResponseInfo response = *trans->GetResponseInfo();
@@ -3043,14 +3035,12 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID9) {
EXPECT_EQ(OK, rv);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof()) << "Read count: "
- << data.read_count()
- << " Read index: "
- << data.read_index();
- EXPECT_TRUE(data.at_write_eof()) << "Write count: "
- << data.write_count()
- << " Write index: "
- << data.write_index();
+ EXPECT_TRUE(data.AllReadDataConsumed())
+ << "Read count: " << data.read_count()
+ << " Read index: " << data.read_index();
+ EXPECT_TRUE(data.AllWriteDataConsumed())
+ << "Write count: " << data.write_count()
+ << " Write index: " << data.write_index();
// Verify the SYN_REPLY.
HttpResponseInfo response = *trans->GetResponseInfo();
@@ -3103,14 +3093,12 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushNoURL) {
rv = callback.WaitForResult();
EXPECT_EQ(OK, rv);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof()) << "Read count: "
- << data.read_count()
- << " Read index: "
- << data.read_index();
- EXPECT_TRUE(data.at_write_eof()) << "Write count: "
- << data.write_count()
- << " Write index: "
- << data.write_index();
+ EXPECT_TRUE(data.AllReadDataConsumed())
+ << "Read count: " << data.read_count()
+ << " Read index: " << data.read_index();
+ EXPECT_TRUE(data.AllWriteDataConsumed())
+ << "Write count: " << data.write_count()
+ << " Write index: " << data.write_index();
// Verify the SYN_REPLY.
HttpResponseInfo response = *trans->GetResponseInfo();
@@ -3579,8 +3567,8 @@ TEST_P(SpdyNetworkTransactionTest, WriteError) {
EXPECT_TRUE(helper.StartDefaultTest());
data.RunFor(2);
helper.FinishDefaultTest();
- EXPECT_TRUE(data.at_write_eof());
- EXPECT_TRUE(!data.at_read_eof());
+ EXPECT_TRUE(data.AllWriteDataConsumed());
+ EXPECT_TRUE(!data.AllReadDataConsumed());
TransactionHelperResult out = helper.output();
EXPECT_EQ(ERR_FAILED, out.rv);
}
@@ -5278,8 +5266,8 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushClaimBeforeHeaders) {
data.RunFor(1);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof());
- EXPECT_TRUE(data.at_write_eof());
+ EXPECT_TRUE(data.AllReadDataConsumed());
+ EXPECT_TRUE(data.AllWriteDataConsumed());
}
// TODO(baranovich): HTTP 2 does not allow multiple HEADERS frames
@@ -5418,8 +5406,8 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushWithTwoHeaderFrames) {
data.RunFor(1);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof());
- EXPECT_TRUE(data.at_write_eof());
+ EXPECT_TRUE(data.AllReadDataConsumed());
+ EXPECT_TRUE(data.AllWriteDataConsumed());
}
TEST_P(SpdyNetworkTransactionTest, ServerPushWithNoStatusHeaderFrames) {
@@ -5525,8 +5513,8 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushWithNoStatusHeaderFrames) {
data.RunFor(1);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof());
- EXPECT_TRUE(data.at_write_eof());
+ EXPECT_TRUE(data.AllReadDataConsumed());
+ EXPECT_TRUE(data.AllWriteDataConsumed());
}
TEST_P(SpdyNetworkTransactionTest, SynReplyWithHeaders) {
@@ -5714,8 +5702,8 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushCrossOriginCorrectness) {
ReadResult(trans, &data, &result);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof());
- EXPECT_TRUE(data.at_write_eof());
+ EXPECT_TRUE(data.AllReadDataConsumed());
+ EXPECT_TRUE(data.AllWriteDataConsumed());
// Verify the SYN_REPLY.
// Copy the response info, because trans goes away.
@@ -5770,14 +5758,12 @@ TEST_P(SpdyNetworkTransactionTest, RetryAfterRefused) {
EXPECT_EQ(OK, rv);
// Verify that we consumed all test data.
- EXPECT_TRUE(data.at_read_eof()) << "Read count: "
- << data.read_count()
- << " Read index: "
- << data.read_index();
- EXPECT_TRUE(data.at_write_eof()) << "Write count: "
- << data.write_count()
- << " Write index: "
- << data.write_index();
+ EXPECT_TRUE(data.AllReadDataConsumed())
+ << "Read count: " << data.read_count()
+ << " Read index: " << data.read_index();
+ EXPECT_TRUE(data.AllWriteDataConsumed())
+ << "Write count: " << data.write_count()
+ << " Write index: " << data.write_index();
// Verify the SYN_REPLY.
HttpResponseInfo response = *trans->GetResponseInfo();

Powered by Google App Engine
This is Rietveld 408576698