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

Side by Side 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: Nit. Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 3615 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 3626
3627 data.RunFor(1); 3627 data.RunFor(1);
3628 3628
3629 EXPECT_EQ(SpdySession::GetInitialWindowSize(GetParam()), 3629 EXPECT_EQ(SpdySession::GetInitialWindowSize(GetParam()),
3630 session->session_recv_window_size_); 3630 session->session_recv_window_size_);
3631 EXPECT_EQ(kUploadDataSize, session->session_unacked_recv_window_bytes_); 3631 EXPECT_EQ(kUploadDataSize, session->session_unacked_recv_window_bytes_);
3632 3632
3633 data.RunFor(1); 3633 data.RunFor(1);
3634 } 3634 }
3635 3635
3636 // The frame header is not included in flow control, but frame payload
3637 // (including optional pad length and padding) is.
3638 TEST_P(SpdySessionTest, SessionFlowControlPadding) {
3639 // Padding only exists in HTTP/2.
3640 if (GetParam() < kProtoSPDY4MinimumVersion)
3641 return;
3642
3643 session_deps_.host_resolver->set_synchronous_mode(true);
3644
3645 const int padding_length = 42;
3646 MockConnect connect_data(SYNCHRONOUS, OK);
3647 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyBodyFrame(
3648 1, kUploadData, kUploadDataSize, false, padding_length));
3649 MockRead reads[] = {
3650 CreateMockRead(*resp, 0), MockRead(ASYNC, 0, 1) // EOF
3651 };
3652 DeterministicSocketData data(reads, arraysize(reads), NULL, 0);
3653 data.set_connect_data(connect_data);
3654 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data);
3655
3656 CreateDeterministicNetworkSession();
3657 base::WeakPtr<SpdySession> session =
3658 CreateInsecureSpdySession(http_session_, key_, BoundNetLog());
3659 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION,
3660 session->flow_control_state());
3661
3662 EXPECT_EQ(SpdySession::GetInitialWindowSize(GetParam()),
3663 session->session_recv_window_size_);
3664 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
3665
3666 data.RunFor(1);
3667
3668 EXPECT_EQ(SpdySession::GetInitialWindowSize(GetParam()),
3669 session->session_recv_window_size_);
3670 EXPECT_EQ(kUploadDataSize + padding_length,
3671 session->session_unacked_recv_window_bytes_);
3672
3673 data.RunFor(1);
3674 }
3675
3636 // A delegate that drops any received data. 3676 // A delegate that drops any received data.
3637 class DropReceivedDataDelegate : public test::StreamDelegateSendImmediate { 3677 class DropReceivedDataDelegate : public test::StreamDelegateSendImmediate {
3638 public: 3678 public:
3639 DropReceivedDataDelegate(const base::WeakPtr<SpdyStream>& stream, 3679 DropReceivedDataDelegate(const base::WeakPtr<SpdyStream>& stream,
3640 base::StringPiece data) 3680 base::StringPiece data)
3641 : StreamDelegateSendImmediate(stream, data) {} 3681 : StreamDelegateSendImmediate(stream, data) {}
3642 3682
3643 ~DropReceivedDataDelegate() override {} 3683 ~DropReceivedDataDelegate() override {}
3644 3684
3645 // Drop any received data. 3685 // Drop any received data.
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
5127 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 5167 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
5128 "spdy_pooling.pem"); 5168 "spdy_pooling.pem");
5129 ssl_info.is_issued_by_known_root = true; 5169 ssl_info.is_issued_by_known_root = true;
5130 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 5170 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
5131 5171
5132 EXPECT_TRUE(SpdySession::CanPool( 5172 EXPECT_TRUE(SpdySession::CanPool(
5133 &tss, ssl_info, "www.example.org", "mail.example.org")); 5173 &tss, ssl_info, "www.example.org", "mail.example.org"));
5134 } 5174 }
5135 5175
5136 } // namespace net 5176 } // namespace net
OLDNEW
« net/spdy/spdy_framer.cc ('K') | « 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