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

Side by Side Diff: net/quic/quic_flow_controller_test.cc

Issue 357573004: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase with TOT Created 6 years, 5 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/quic/quic_flow_controller.cc ('k') | net/quic/quic_headers_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/quic/quic_flow_controller.h" 5 #include "net/quic/quic_flow_controller.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "net/quic/quic_flags.h"
9 #include "net/quic/quic_utils.h" 8 #include "net/quic/quic_utils.h"
10 #include "net/quic/test_tools/quic_connection_peer.h" 9 #include "net/quic/test_tools/quic_connection_peer.h"
11 #include "net/quic/test_tools/quic_flow_controller_peer.h" 10 #include "net/quic/test_tools/quic_flow_controller_peer.h"
12 #include "net/quic/test_tools/quic_test_utils.h" 11 #include "net/quic/test_tools/quic_test_utils.h"
13 #include "net/test/gtest_util.h" 12 #include "net/test/gtest_util.h"
14 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
15 14
16 using base::StringPrintf; 15 using base::StringPrintf;
17 16
18 namespace net { 17 namespace net {
19 namespace test { 18 namespace test {
20 19
21 using ::testing::_; 20 using ::testing::_;
22 21
23 class QuicFlowControllerTest : public ::testing::Test { 22 class QuicFlowControllerTest : public ::testing::Test {
24 public: 23 public:
25 QuicFlowControllerTest() 24 QuicFlowControllerTest()
26 : stream_id_(1234), 25 : stream_id_(1234),
27 send_window_(kInitialSessionFlowControlWindowForTest), 26 send_window_(kInitialSessionFlowControlWindowForTest),
28 receive_window_(kInitialSessionFlowControlWindowForTest), 27 receive_window_(kInitialSessionFlowControlWindowForTest),
29 max_receive_window_(kInitialSessionFlowControlWindowForTest), 28 max_receive_window_(kInitialSessionFlowControlWindowForTest),
30 connection_(false), 29 connection_(false) {
31 old_flag_(&FLAGS_enable_quic_stream_flow_control_2, true) {
32 } 30 }
33 31
34 void Initialize() { 32 void Initialize() {
35 flow_controller_.reset(new QuicFlowController( 33 flow_controller_.reset(new QuicFlowController(
36 &connection_, stream_id_, false, send_window_, 34 &connection_, stream_id_, false, send_window_,
37 receive_window_, max_receive_window_)); 35 receive_window_, max_receive_window_));
38 } 36 }
39 37
40 protected: 38 protected:
41 QuicStreamId stream_id_; 39 QuicStreamId stream_id_;
42 uint64 send_window_; 40 uint64 send_window_;
43 uint64 receive_window_; 41 uint64 receive_window_;
44 uint64 max_receive_window_; 42 uint64 max_receive_window_;
45 scoped_ptr<QuicFlowController> flow_controller_; 43 scoped_ptr<QuicFlowController> flow_controller_;
46 MockConnection connection_; 44 MockConnection connection_;
47 ValueRestore<bool> old_flag_;
48 }; 45 };
49 46
50 TEST_F(QuicFlowControllerTest, SendingBytes) { 47 TEST_F(QuicFlowControllerTest, SendingBytes) {
51 Initialize(); 48 Initialize();
52 49
53 EXPECT_TRUE(flow_controller_->IsEnabled()); 50 EXPECT_TRUE(flow_controller_->IsEnabled());
54 EXPECT_FALSE(flow_controller_->IsBlocked()); 51 EXPECT_FALSE(flow_controller_->IsBlocked());
55 EXPECT_FALSE(flow_controller_->FlowControlViolation()); 52 EXPECT_FALSE(flow_controller_->FlowControlViolation());
56 EXPECT_EQ(send_window_, flow_controller_->SendWindowSize()); 53 EXPECT_EQ(send_window_, flow_controller_->SendWindowSize());
57 54
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 flow_controller_->AddBytesSent(send_window_); 212 flow_controller_->AddBytesSent(send_window_);
216 EXPECT_TRUE(flow_controller_->IsBlocked()); 213 EXPECT_TRUE(flow_controller_->IsBlocked());
217 EXPECT_EQ(0u, flow_controller_->SendWindowSize()); 214 EXPECT_EQ(0u, flow_controller_->SendWindowSize());
218 215
219 // BLOCKED frame should get sent as send offset has changed. 216 // BLOCKED frame should get sent as send offset has changed.
220 flow_controller_->MaybeSendBlocked(); 217 flow_controller_->MaybeSendBlocked();
221 } 218 }
222 219
223 } // namespace test 220 } // namespace test
224 } // namespace net 221 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flow_controller.cc ('k') | net/quic/quic_headers_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698