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

Unified Diff: net/spdy/spdy_session_unittest.cc

Issue 959743002: Account for HTTP/2 padding in receive windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more mock implementation. Created 5 years, 9 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/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session_unittest.cc
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 5b4862ae4dd0ae1303c6d44f78f424a059cf61ab..5713d26ba615d5904af1063a838376dcbf7711fb 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -3630,6 +3630,46 @@ TEST_P(SpdySessionTest, SessionFlowControlInactiveStream) {
data.RunFor(1);
}
+// The frame header is not included in flow control, but frame payload
+// (including optional pad length and padding) is.
+TEST_P(SpdySessionTest, SessionFlowControlPadding) {
+ // Padding only exists in HTTP/2.
+ if (GetParam() < kProtoSPDY4MinimumVersion)
+ return;
+
+ session_deps_.host_resolver->set_synchronous_mode(true);
+
+ const int padding_length = 42;
+ MockConnect connect_data(SYNCHRONOUS, OK);
+ scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyBodyFrame(
+ 1, kUploadData, kUploadDataSize, false, padding_length));
+ MockRead reads[] = {
+ CreateMockRead(*resp, 0), MockRead(ASYNC, 0, 1) // EOF
+ };
+ DeterministicSocketData data(reads, arraysize(reads), NULL, 0);
+ data.set_connect_data(connect_data);
+ session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data);
+
+ CreateDeterministicNetworkSession();
+ base::WeakPtr<SpdySession> session =
+ CreateInsecureSpdySession(http_session_, key_, BoundNetLog());
+ EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION,
+ session->flow_control_state());
+
+ EXPECT_EQ(SpdySession::GetInitialWindowSize(GetParam()),
+ session->session_recv_window_size_);
+ EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
+
+ data.RunFor(1);
+
+ EXPECT_EQ(SpdySession::GetInitialWindowSize(GetParam()),
+ session->session_recv_window_size_);
+ EXPECT_EQ(kUploadDataSize + padding_length,
+ session->session_unacked_recv_window_bytes_);
+
+ data.RunFor(1);
+}
+
// A delegate that drops any received data.
class DropReceivedDataDelegate : public test::StreamDelegateSendImmediate {
public:
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698