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

Side by Side Diff: net/spdy/spdy_session_unittest.cc

Issue 22610006: [SPDY] Count closed-stream DATA frames for session flow control (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak comments Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3171 3171
3172 session->IncreaseSendWindowSize(delta_window_size); 3172 session->IncreaseSendWindowSize(delta_window_size);
3173 EXPECT_EQ(kSpdySessionInitialWindowSize + delta_window_size, 3173 EXPECT_EQ(kSpdySessionInitialWindowSize + delta_window_size,
3174 session->session_send_window_size_); 3174 session->session_send_window_size_);
3175 3175
3176 session->DecreaseSendWindowSize(delta_window_size); 3176 session->DecreaseSendWindowSize(delta_window_size);
3177 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_send_window_size_); 3177 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_send_window_size_);
3178 } 3178 }
3179 3179
3180 // Incoming data for an inactive stream should not cause the session 3180 // Incoming data for an inactive stream should not cause the session
3181 // receive window size to decrease. 3181 // receive window size to decrease, but it should cause the unacked
3182 // bytes to increase.
3182 TEST_P(SpdySessionTest, SessionFlowControlInactiveStream) { 3183 TEST_P(SpdySessionTest, SessionFlowControlInactiveStream) {
3183 if (GetParam() < kProtoSPDY31) 3184 if (GetParam() < kProtoSPDY31)
3184 return; 3185 return;
3185 3186
3186 session_deps_.host_resolver->set_synchronous_mode(true); 3187 session_deps_.host_resolver->set_synchronous_mode(true);
3187 3188
3188 MockConnect connect_data(SYNCHRONOUS, OK); 3189 MockConnect connect_data(SYNCHRONOUS, OK);
3189 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyBodyFrame(1, false)); 3190 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyBodyFrame(1, false));
3190 MockRead reads[] = { 3191 MockRead reads[] = {
3191 CreateMockRead(*resp, 0), 3192 CreateMockRead(*resp, 0),
(...skipping 11 matching lines...) Expand all
3203 CreateInsecureSpdySession(http_session_, key_, BoundNetLog()); 3204 CreateInsecureSpdySession(http_session_, key_, BoundNetLog());
3204 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION, 3205 EXPECT_EQ(SpdySession::FLOW_CONTROL_STREAM_AND_SESSION,
3205 session->flow_control_state()); 3206 session->flow_control_state());
3206 3207
3207 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_recv_window_size_); 3208 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_recv_window_size_);
3208 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_); 3209 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_);
3209 3210
3210 data.RunFor(1); 3211 data.RunFor(1);
3211 3212
3212 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_recv_window_size_); 3213 EXPECT_EQ(kSpdySessionInitialWindowSize, session->session_recv_window_size_);
3213 EXPECT_EQ(0, session->session_unacked_recv_window_bytes_); 3214 EXPECT_EQ(kUploadDataSize, session->session_unacked_recv_window_bytes_);
3214 3215
3215 data.RunFor(1); 3216 data.RunFor(1);
3216 } 3217 }
3217 3218
3218 // A delegate that drops any received data. 3219 // A delegate that drops any received data.
3219 class DropReceivedDataDelegate : public test::StreamDelegateSendImmediate { 3220 class DropReceivedDataDelegate : public test::StreamDelegateSendImmediate {
3220 public: 3221 public:
3221 DropReceivedDataDelegate(const base::WeakPtr<SpdyStream>& stream, 3222 DropReceivedDataDelegate(const base::WeakPtr<SpdyStream>& stream,
3222 base::StringPiece data) 3223 base::StringPiece data)
3223 : StreamDelegateSendImmediate(stream, data) {} 3224 : StreamDelegateSendImmediate(stream, data) {}
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
4106 EXPECT_TRUE(delegate1.send_headers_completed()); 4107 EXPECT_TRUE(delegate1.send_headers_completed());
4107 EXPECT_EQ(std::string(), delegate1.TakeReceivedData()); 4108 EXPECT_EQ(std::string(), delegate1.TakeReceivedData());
4108 4109
4109 EXPECT_TRUE(delegate2.send_headers_completed()); 4110 EXPECT_TRUE(delegate2.send_headers_completed());
4110 EXPECT_EQ(std::string(), delegate2.TakeReceivedData()); 4111 EXPECT_EQ(std::string(), delegate2.TakeReceivedData());
4111 4112
4112 EXPECT_TRUE(data.at_write_eof()); 4113 EXPECT_TRUE(data.at_write_eof());
4113 } 4114 }
4114 4115
4115 } // namespace net 4116 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698