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

Side by Side Diff: net/quic/reliable_quic_stream_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/reliable_quic_stream.cc ('k') | net/quic/test_tools/crypto_test_utils.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 (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/quic/reliable_quic_stream.h" 5 #include "net/quic/reliable_quic_stream.h"
6 6
7 #include "net/quic/quic_ack_notifier.h" 7 #include "net/quic/quic_ack_notifier.h"
8 #include "net/quic/quic_connection.h" 8 #include "net/quic/quic_connection.h"
9 #include "net/quic/quic_utils.h" 9 #include "net/quic/quic_utils.h"
10 #include "net/quic/quic_write_blocked_list.h" 10 #include "net/quic/quic_write_blocked_list.h"
(...skipping 20 matching lines...) Expand all
31 using testing::WithArgs; 31 using testing::WithArgs;
32 using testing::_; 32 using testing::_;
33 33
34 namespace net { 34 namespace net {
35 namespace test { 35 namespace test {
36 namespace { 36 namespace {
37 37
38 const char kData1[] = "FooAndBar"; 38 const char kData1[] = "FooAndBar";
39 const char kData2[] = "EepAndBaz"; 39 const char kData2[] = "EepAndBaz";
40 const size_t kDataLen = 9; 40 const size_t kDataLen = 9;
41 const bool kIsServer = true;
42 const bool kShouldProcessData = true; 41 const bool kShouldProcessData = true;
43 42
44 class TestStream : public ReliableQuicStream { 43 class TestStream : public ReliableQuicStream {
45 public: 44 public:
46 TestStream(QuicStreamId id, 45 TestStream(QuicStreamId id,
47 QuicSession* session, 46 QuicSession* session,
48 bool should_process_data) 47 bool should_process_data)
49 : ReliableQuicStream(id, session), 48 : ReliableQuicStream(id, session),
50 should_process_data_(should_process_data) {} 49 should_process_data_(should_process_data) {}
51 50
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 "edlR9FsEdH6iujMcHkbE5l18ehJDwTWmBKBzVD87naobhMMrF6VvnDGxQVGp9Ir_b" 98 "edlR9FsEdH6iujMcHkbE5l18ehJDwTWmBKBzVD87naobhMMrF6VvnDGxQVGp9Ir_b"
100 "Rgj3RWUoPumQVCxtSOBdX0GlJOEcDTNCzQIm9BSfetog_eP_TfYubKudt5eMsXmN6" 99 "Rgj3RWUoPumQVCxtSOBdX0GlJOEcDTNCzQIm9BSfetog_eP_TfYubKudt5eMsXmN6"
101 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" 100 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG"
102 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" 101 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk"
103 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" 102 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn"
104 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" 103 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr"
105 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; 104 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo ";
106 } 105 }
107 106
108 void Initialize(bool stream_should_process_data) { 107 void Initialize(bool stream_should_process_data) {
109 connection_ = 108 connection_ = new StrictMock<MockConnection>(Perspective::IS_SERVER,
110 new StrictMock<MockConnection>(kIsServer, supported_versions_); 109 supported_versions_);
111 session_.reset(new StrictMock<MockSession>(connection_)); 110 session_.reset(new StrictMock<MockSession>(connection_));
112 111
113 // New streams rely on having the peer's flow control receive window 112 // New streams rely on having the peer's flow control receive window
114 // negotiated in the config. 113 // negotiated in the config.
115 QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow( 114 QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow(
116 session_->config(), initial_flow_control_window_bytes_); 115 session_->config(), initial_flow_control_window_bytes_);
117 116
118 stream_.reset(new TestStream(kHeadersStreamId, session_.get(), 117 stream_.reset(new TestStream(kHeadersStreamId, session_.get(),
119 stream_should_process_data)); 118 stream_should_process_data));
120 write_blocked_list_ = 119 write_blocked_list_ =
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 637
639 EXPECT_FALSE(stream_->HasFinalReceivedByteOffset()); 638 EXPECT_FALSE(stream_->HasFinalReceivedByteOffset());
640 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234); 639 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234);
641 stream_->OnStreamReset(rst_frame); 640 stream_->OnStreamReset(rst_frame);
642 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); 641 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset());
643 } 642 }
644 643
645 } // namespace 644 } // namespace
646 } // namespace test 645 } // namespace test
647 } // namespace net 646 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | net/quic/test_tools/crypto_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698