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

Side by Side Diff: net/tools/quic/quic_server_session_test.cc

Issue 180723003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unintialized memory error Created 6 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_dispatcher.cc ('k') | net/tools/quic/quic_spdy_server_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/tools/quic/quic_server_session.h" 5 #include "net/tools/quic/quic_server_session.h"
6 6
7 #include "net/quic/crypto/quic_crypto_server_config.h" 7 #include "net/quic/crypto/quic_crypto_server_config.h"
8 #include "net/quic/crypto/quic_random.h" 8 #include "net/quic/crypto/quic_random.h"
9 #include "net/quic/quic_connection.h" 9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_utils.h" 10 #include "net/quic/quic_utils.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 session()->MarkDecompressionBlocked(1, id()); 50 session()->MarkDecompressionBlocked(1, id());
51 session()->CloseStream(id()); 51 session()->CloseStream(id());
52 return true; 52 return true;
53 } 53 }
54 54
55 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE { 55 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE {
56 return 0; 56 return 0;
57 } 57 }
58 }; 58 };
59 59
60 class TestQuicQuicServerSession : public QuicServerSession { 60 class TestQuicServerSession : public QuicServerSession {
61 public: 61 public:
62 TestQuicQuicServerSession(const QuicConfig& config, 62 TestQuicServerSession(const QuicConfig& config,
63 QuicConnection* connection, 63 QuicConnection* connection,
64 QuicServerSessionVisitor* owner) 64 QuicServerSessionVisitor* owner)
65 : QuicServerSession(config, connection, owner), 65 : QuicServerSession(config, connection, owner),
66 close_stream_on_data_(false) {} 66 close_stream_on_data_(false) {}
67 67
68 virtual QuicDataStream* CreateIncomingDataStream( 68 virtual QuicDataStream* CreateIncomingDataStream(
69 QuicStreamId id) OVERRIDE { 69 QuicStreamId id) OVERRIDE {
70 if (!ShouldCreateIncomingDataStream(id)) { 70 if (!ShouldCreateIncomingDataStream(id)) {
71 return NULL; 71 return NULL;
72 } 72 }
(...skipping 17 matching lines...) Expand all
90 class QuicServerSessionTest : public ::testing::TestWithParam<QuicVersion> { 90 class QuicServerSessionTest : public ::testing::TestWithParam<QuicVersion> {
91 protected: 91 protected:
92 QuicServerSessionTest() 92 QuicServerSessionTest()
93 : crypto_config_(QuicCryptoServerConfig::TESTING, 93 : crypto_config_(QuicCryptoServerConfig::TESTING,
94 QuicRandom::GetInstance()) { 94 QuicRandom::GetInstance()) {
95 config_.SetDefaults(); 95 config_.SetDefaults();
96 config_.set_max_streams_per_connection(3, 3); 96 config_.set_max_streams_per_connection(3, 3);
97 97
98 connection_ = 98 connection_ =
99 new StrictMock<MockConnection>(true, SupportedVersions(GetParam())); 99 new StrictMock<MockConnection>(true, SupportedVersions(GetParam()));
100 session_.reset(new TestQuicQuicServerSession( 100 session_.reset(new TestQuicServerSession(
101 config_, connection_, &owner_)); 101 config_, connection_, &owner_));
102 session_->InitializeSession(crypto_config_); 102 session_->InitializeSession(crypto_config_);
103 visitor_ = QuicConnectionPeer::GetVisitor(connection_); 103 visitor_ = QuicConnectionPeer::GetVisitor(connection_);
104 } 104 }
105 105
106 void MarkHeadersReadForStream(QuicStreamId id) { 106 void MarkHeadersReadForStream(QuicStreamId id) {
107 QuicDataStream* stream = QuicServerSessionPeer::GetDataStream( 107 QuicDataStream* stream = QuicServerSessionPeer::GetDataStream(
108 session_.get(), id); 108 session_.get(), id);
109 ASSERT_TRUE(stream != NULL); 109 ASSERT_TRUE(stream != NULL);
110 QuicDataStreamPeer::SetHeadersDecompressed(stream, true); 110 QuicDataStreamPeer::SetHeadersDecompressed(stream, true);
111 } 111 }
112 112
113 QuicVersion version() const { return connection_->version(); } 113 QuicVersion version() const { return connection_->version(); }
114 114
115 StrictMock<MockQuicServerSessionVisitor> owner_; 115 StrictMock<MockQuicServerSessionVisitor> owner_;
116 StrictMock<MockConnection>* connection_; 116 StrictMock<MockConnection>* connection_;
117 QuicConfig config_; 117 QuicConfig config_;
118 QuicCryptoServerConfig crypto_config_; 118 QuicCryptoServerConfig crypto_config_;
119 scoped_ptr<TestQuicQuicServerSession> session_; 119 scoped_ptr<TestQuicServerSession> session_;
120 QuicConnectionVisitorInterface* visitor_; 120 QuicConnectionVisitorInterface* visitor_;
121 }; 121 };
122 122
123 INSTANTIATE_TEST_CASE_P(Tests, QuicServerSessionTest, 123 INSTANTIATE_TEST_CASE_P(Tests, QuicServerSessionTest,
124 ::testing::ValuesIn(QuicSupportedVersions())); 124 ::testing::ValuesIn(QuicSupportedVersions()));
125 125
126 TEST_P(QuicServerSessionTest, CloseStreamDueToReset) { 126 TEST_P(QuicServerSessionTest, CloseStreamDueToReset) {
127 QuicStreamId stream_id = (version() == QUIC_VERSION_12 ? 3 : 5); 127 QuicStreamId stream_id = (version() == QUIC_VERSION_12 ? 3 : 5);
128 // Open a stream, then reset it. 128 // Open a stream, then reset it.
129 // Send two bytes of payload to open it. 129 // Send two bytes of payload to open it.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // Incoming streams on the server session must be odd. 265 // Incoming streams on the server session must be odd.
266 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID)); 266 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID));
267 EXPECT_EQ(NULL, 267 EXPECT_EQ(NULL,
268 QuicServerSessionPeer::GetIncomingDataStream(session_.get(), 4)); 268 QuicServerSessionPeer::GetIncomingDataStream(session_.get(), 4));
269 } 269 }
270 270
271 } // namespace 271 } // namespace
272 } // namespace test 272 } // namespace test
273 } // namespace tools 273 } // namespace tools
274 } // namespace net 274 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.cc ('k') | net/tools/quic/quic_spdy_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698