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

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

Issue 114933003: Minor cleanup of QUIC MockConnection and PacketSavingConnection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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_crypto_stream_test.cc ('k') | net/quic/quic_reliable_client_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 (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/quic_data_stream.h" 5 #include "net/quic/quic_data_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_spdy_compressor.h" 9 #include "net/quic/quic_spdy_compressor.h"
10 #include "net/quic/quic_spdy_decompressor.h" 10 #include "net/quic/quic_spdy_decompressor.h"
11 #include "net/quic/quic_utils.h" 11 #include "net/quic/quic_utils.h"
12 #include "net/quic/spdy_utils.h" 12 #include "net/quic/spdy_utils.h"
13 #include "net/quic/test_tools/quic_session_peer.h" 13 #include "net/quic/test_tools/quic_session_peer.h"
14 #include "net/quic/test_tools/quic_test_utils.h" 14 #include "net/quic/test_tools/quic_test_utils.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 16
17 using base::StringPiece; 17 using base::StringPiece;
18 using std::min; 18 using std::min;
19 using testing::_; 19 using testing::_;
20 using testing::InSequence; 20 using testing::InSequence;
21 using testing::Return; 21 using testing::Return;
22 using testing::SaveArg; 22 using testing::SaveArg;
23 using testing::StrEq; 23 using testing::StrEq;
24 using testing::StrictMock; 24 using testing::StrictMock;
25 25
26 namespace net { 26 namespace net {
27 namespace test { 27 namespace test {
28 namespace { 28 namespace {
29 29
30 const QuicGuid kGuid = 42;
31 const QuicGuid kStreamId = 3; 30 const QuicGuid kStreamId = 3;
32 const bool kIsServer = true; 31 const bool kIsServer = true;
33 const bool kShouldProcessData = true; 32 const bool kShouldProcessData = true;
34 33
35 class TestStream : public QuicDataStream { 34 class TestStream : public QuicDataStream {
36 public: 35 public:
37 TestStream(QuicStreamId id, 36 TestStream(QuicStreamId id,
38 QuicSession* session, 37 QuicSession* session,
39 bool should_process_data) 38 bool should_process_data)
40 : QuicDataStream(id, session), 39 : QuicDataStream(id, session),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 "edlR9FsEdH6iujMcHkbE5l18ehJDwTWmBKBzVD87naobhMMrF6VvnDGxQVGp9Ir_b" 83 "edlR9FsEdH6iujMcHkbE5l18ehJDwTWmBKBzVD87naobhMMrF6VvnDGxQVGp9Ir_b"
85 "Rgj3RWUoPumQVCxtSOBdX0GlJOEcDTNCzQIm9BSfetog_eP_TfYubKudt5eMsXmN6" 84 "Rgj3RWUoPumQVCxtSOBdX0GlJOEcDTNCzQIm9BSfetog_eP_TfYubKudt5eMsXmN6"
86 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" 85 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG"
87 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" 86 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk"
88 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" 87 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn"
89 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" 88 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr"
90 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; 89 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo ";
91 } 90 }
92 91
93 void Initialize(bool stream_should_process_data) { 92 void Initialize(bool stream_should_process_data) {
94 connection_ = new testing::StrictMock<MockConnection>( 93 connection_ = new StrictMock<MockConnection>(kIsServer);
95 kGuid, IPEndPoint(), kIsServer); 94 session_.reset(new StrictMock<MockSession>(connection_, kIsServer));
96 session_.reset(new testing::StrictMock<MockSession>(
97 connection_, kIsServer));
98 stream_.reset(new TestStream(kStreamId, session_.get(), 95 stream_.reset(new TestStream(kStreamId, session_.get(),
99 stream_should_process_data)); 96 stream_should_process_data));
100 stream2_.reset(new TestStream(kStreamId + 2, session_.get(), 97 stream2_.reset(new TestStream(kStreamId + 2, session_.get(),
101 stream_should_process_data)); 98 stream_should_process_data));
102 compressor_.reset(new QuicSpdyCompressor()); 99 compressor_.reset(new QuicSpdyCompressor());
103 decompressor_.reset(new QuicSpdyDecompressor); 100 decompressor_.reset(new QuicSpdyDecompressor);
104 write_blocked_list_ = 101 write_blocked_list_ =
105 QuicSessionPeer::GetWriteblockedStreams(session_.get()); 102 QuicSessionPeer::GetWriteblockedStreams(session_.get());
106 } 103 }
107 104
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_HEADER_ID)) 443 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_HEADER_ID))
447 .Times(0); 444 .Times(0);
448 QuicStreamFrame frame2(stream_->id(), false, compressed_headers.length(), 445 QuicStreamFrame frame2(stream_->id(), false, compressed_headers.length(),
449 MakeIOVector("body data")); 446 MakeIOVector("body data"));
450 stream_->OnStreamFrame(frame2); 447 stream_->OnStreamFrame(frame2);
451 } 448 }
452 449
453 } // namespace 450 } // namespace
454 } // namespace test 451 } // namespace test
455 } // namespace net 452 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_stream_test.cc ('k') | net/quic/quic_reliable_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698