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

Unified Diff: net/quic/quic_http_stream_test.cc

Issue 1327533002: Implemented QuicHttpStream::GetTotalSentBytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@http_stream_sent_bytes
Patch Set: Created 5 years, 4 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
« net/quic/quic_http_stream.cc ('K') | « net/quic/quic_http_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_http_stream_test.cc
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc
index 625b33b89db284c9175bc67bb705c375053088fc..ce63ede876b981a4628c5a269237a94804f988e2 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -4,6 +4,8 @@
#include "net/quic/quic_http_stream.h"
+#include <stdint.h>
+
#include <vector>
#include "base/thread_task_runner_handle.h"
@@ -386,6 +388,11 @@ TEST_P(QuicHttpStreamTest, GetRequest) {
callback_.callback()));
EXPECT_TRUE(stream_->IsResponseBodyComplete());
EXPECT_TRUE(AtEof());
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
bengr 2015/09/01 17:16:06 Does "currently" suggest a TODO?
sclittle 2015/09/02 00:06:23 Sure, added a TODO in quic_http_stream.cc.
+ // payload.
+ EXPECT_EQ(0, stream_->GetTotalSentBytes());
+ EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
}
// Regression test for http://crbug.com/288128
@@ -429,6 +436,11 @@ TEST_P(QuicHttpStreamTest, GetRequestLargeResponse) {
callback_.callback()));
EXPECT_TRUE(stream_->IsResponseBodyComplete());
EXPECT_TRUE(AtEof());
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(0, stream_->GetTotalSentBytes());
+ EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
}
// Regression test for http://crbug.com/409101
@@ -447,6 +459,9 @@ TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendRequest) {
EXPECT_EQ(ERR_CONNECTION_CLOSED,
stream_->SendRequest(headers_, &response_,
callback_.callback()));
+
+ EXPECT_EQ(0, stream_->GetTotalSentBytes());
+ EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
}
// Regression test for http://crbug.com/409871
@@ -467,6 +482,11 @@ TEST_P(QuicHttpStreamTest, SessionClosedBeforeReadResponseHeaders) {
session_->connection()->CloseConnection(QUIC_NO_ERROR, true);
EXPECT_NE(OK, stream_->ReadResponseHeaders(callback_.callback()));
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(0, stream_->GetTotalSentBytes());
+ EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
}
TEST_P(QuicHttpStreamTest, SendPostRequest) {
@@ -515,6 +535,13 @@ TEST_P(QuicHttpStreamTest, SendPostRequest) {
EXPECT_TRUE(stream_->IsResponseBodyComplete());
EXPECT_TRUE(AtEof());
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(static_cast<int64_t>(strlen(kUploadData)),
+ stream_->GetTotalSentBytes());
+ EXPECT_EQ(static_cast<int64_t>(strlen(kResponseBody)),
+ stream_->GetTotalReceivedBytes());
}
TEST_P(QuicHttpStreamTest, SendChunkedPostRequest) {
@@ -570,6 +597,13 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequest) {
EXPECT_TRUE(stream_->IsResponseBodyComplete());
EXPECT_TRUE(AtEof());
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(static_cast<int64_t>(strlen(kUploadData) * 2),
bengr 2015/09/01 17:16:06 Why *2?
sclittle 2015/09/02 00:06:23 Because 2 chunks of kUploadData were sent with the
+ stream_->GetTotalSentBytes());
+ EXPECT_EQ(static_cast<int64_t>(strlen(kResponseBody)),
+ stream_->GetTotalReceivedBytes());
}
TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithFinalEmptyDataPacket) {
@@ -622,6 +656,13 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithFinalEmptyDataPacket) {
callback_.callback()));
EXPECT_TRUE(stream_->IsResponseBodyComplete());
EXPECT_TRUE(AtEof());
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(static_cast<int64_t>(strlen(kUploadData)),
+ stream_->GetTotalSentBytes());
+ EXPECT_EQ(static_cast<int64_t>(strlen(kResponseBody)),
+ stream_->GetTotalReceivedBytes());
}
TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithOneEmptyDataPacket) {
@@ -672,6 +713,12 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithOneEmptyDataPacket) {
EXPECT_TRUE(stream_->IsResponseBodyComplete());
EXPECT_TRUE(AtEof());
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(0, stream_->GetTotalSentBytes());
+ EXPECT_EQ(static_cast<int64_t>(strlen(kResponseBody)),
+ stream_->GetTotalReceivedBytes());
}
TEST_P(QuicHttpStreamTest, DestroyedEarly) {
@@ -706,6 +753,11 @@ TEST_P(QuicHttpStreamTest, DestroyedEarly) {
base::MessageLoop::current()->RunUntilIdle();
EXPECT_TRUE(AtEof());
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(0, stream_->GetTotalSentBytes());
+ EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
}
TEST_P(QuicHttpStreamTest, Priority) {
@@ -752,6 +804,11 @@ TEST_P(QuicHttpStreamTest, Priority) {
base::MessageLoop::current()->RunUntilIdle();
EXPECT_TRUE(AtEof());
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(0, stream_->GetTotalSentBytes());
+ EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
}
// Regression test for http://crbug.com/294870
@@ -784,6 +841,11 @@ TEST_P(QuicHttpStreamTest, CheckPriorityWithNoDelegate) {
DCHECK_EQ(QuicWriteBlockedList::kHighestPriority,
reliable_stream->EffectivePriority());
reliable_stream->SetDelegate(delegate);
+
+ // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
+ // payload.
+ EXPECT_EQ(0, stream_->GetTotalSentBytes());
+ EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
}
} // namespace test
« net/quic/quic_http_stream.cc ('K') | « net/quic/quic_http_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698