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

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

Issue 1009543004: Create a Perspective enum to use instead of a bool is_server to improve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NET_EXPORT_PRIVATE to fix compiler error 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_flow_controller.cc ('k') | net/quic/quic_framer.h » ('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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "net/quic/quic_utils.h" 9 #include "net/quic/quic_utils.h"
10 #include "net/quic/test_tools/quic_connection_peer.h" 10 #include "net/quic/test_tools/quic_connection_peer.h"
11 #include "net/quic/test_tools/quic_flow_controller_peer.h" 11 #include "net/quic/test_tools/quic_flow_controller_peer.h"
12 #include "net/quic/test_tools/quic_test_utils.h" 12 #include "net/quic/test_tools/quic_test_utils.h"
13 #include "net/test/gtest_util.h" 13 #include "net/test/gtest_util.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 15
16 namespace net { 16 namespace net {
17 namespace test { 17 namespace test {
18 18
19 class QuicFlowControllerTest : public ::testing::Test { 19 class QuicFlowControllerTest : public ::testing::Test {
20 public: 20 public:
21 QuicFlowControllerTest() 21 QuicFlowControllerTest()
22 : stream_id_(1234), 22 : stream_id_(1234),
23 send_window_(kInitialSessionFlowControlWindowForTest), 23 send_window_(kInitialSessionFlowControlWindowForTest),
24 receive_window_(kInitialSessionFlowControlWindowForTest), 24 receive_window_(kInitialSessionFlowControlWindowForTest),
25 max_receive_window_(kInitialSessionFlowControlWindowForTest), 25 max_receive_window_(kInitialSessionFlowControlWindowForTest),
26 connection_(false) { 26 connection_(Perspective::IS_CLIENT) {}
27 }
28 27
29 void Initialize() { 28 void Initialize() {
30 flow_controller_.reset(new QuicFlowController( 29 flow_controller_.reset(new QuicFlowController(
31 &connection_, stream_id_, false, send_window_, 30 &connection_, stream_id_, Perspective::IS_CLIENT, send_window_,
32 receive_window_, max_receive_window_)); 31 receive_window_, max_receive_window_));
33 } 32 }
34 33
35 protected: 34 protected:
36 QuicStreamId stream_id_; 35 QuicStreamId stream_id_;
37 QuicByteCount send_window_; 36 QuicByteCount send_window_;
38 QuicByteCount receive_window_; 37 QuicByteCount receive_window_;
39 QuicByteCount max_receive_window_; 38 QuicByteCount max_receive_window_;
40 scoped_ptr<QuicFlowController> flow_controller_; 39 scoped_ptr<QuicFlowController> flow_controller_;
41 MockConnection connection_; 40 MockConnection connection_;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 flow_controller_->AddBytesSent(send_window_); 142 flow_controller_->AddBytesSent(send_window_);
144 EXPECT_TRUE(flow_controller_->IsBlocked()); 143 EXPECT_TRUE(flow_controller_->IsBlocked());
145 EXPECT_EQ(0u, flow_controller_->SendWindowSize()); 144 EXPECT_EQ(0u, flow_controller_->SendWindowSize());
146 145
147 // BLOCKED frame should get sent as send offset has changed. 146 // BLOCKED frame should get sent as send offset has changed.
148 flow_controller_->MaybeSendBlocked(); 147 flow_controller_->MaybeSendBlocked();
149 } 148 }
150 149
151 } // namespace test 150 } // namespace test
152 } // namespace net 151 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flow_controller.cc ('k') | net/quic/quic_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698