| OLD | NEW |
| 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/test_tools/quic_connection_peer.h" | 10 #include "net/quic/test_tools/quic_connection_peer.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 bool close_stream_on_data_; | 84 bool close_stream_on_data_; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 namespace { | 87 namespace { |
| 88 | 88 |
| 89 class QuicServerSessionTest : public ::testing::Test { | 89 class QuicServerSessionTest : public ::testing::Test { |
| 90 protected: | 90 protected: |
| 91 QuicServerSessionTest() | 91 QuicServerSessionTest() |
| 92 : guid_(1), | 92 : crypto_config_(QuicCryptoServerConfig::TESTING, |
| 93 crypto_config_(QuicCryptoServerConfig::TESTING, | |
| 94 QuicRandom::GetInstance()) { | 93 QuicRandom::GetInstance()) { |
| 95 config_.SetDefaults(); | 94 config_.SetDefaults(); |
| 96 config_.set_max_streams_per_connection(3, 3); | 95 config_.set_max_streams_per_connection(3, 3); |
| 97 | 96 |
| 98 connection_ = new MockConnection(guid_, IPEndPoint(), 0, &eps_, true); | 97 connection_ = new MockConnection(true); |
| 99 session_.reset(new TestQuicQuicServerSession( | 98 session_.reset(new TestQuicQuicServerSession( |
| 100 config_, connection_, &owner_)); | 99 config_, connection_, &owner_)); |
| 101 session_->InitializeSession(crypto_config_); | 100 session_->InitializeSession(crypto_config_); |
| 102 visitor_ = QuicConnectionPeer::GetVisitor(connection_); | 101 visitor_ = QuicConnectionPeer::GetVisitor(connection_); |
| 103 } | 102 } |
| 104 | 103 |
| 105 void MarkHeadersReadForStream(QuicStreamId id) { | 104 void MarkHeadersReadForStream(QuicStreamId id) { |
| 106 QuicDataStream* stream = QuicServerSessionPeer::GetDataStream( | 105 QuicDataStream* stream = QuicServerSessionPeer::GetDataStream( |
| 107 session_.get(), id); | 106 session_.get(), id); |
| 108 ASSERT_TRUE(stream != NULL); | 107 ASSERT_TRUE(stream != NULL); |
| 109 QuicDataStreamPeer::SetHeadersDecompressed(stream, true); | 108 QuicDataStreamPeer::SetHeadersDecompressed(stream, true); |
| 110 } | 109 } |
| 111 | 110 |
| 112 QuicGuid guid_; | |
| 113 EpollServer eps_; | |
| 114 StrictMock<MockQuicSessionOwner> owner_; | 111 StrictMock<MockQuicSessionOwner> owner_; |
| 115 MockConnection* connection_; | 112 MockConnection* connection_; |
| 116 QuicConfig config_; | 113 QuicConfig config_; |
| 117 QuicCryptoServerConfig crypto_config_; | 114 QuicCryptoServerConfig crypto_config_; |
| 118 scoped_ptr<TestQuicQuicServerSession> session_; | 115 scoped_ptr<TestQuicQuicServerSession> session_; |
| 119 QuicConnectionVisitorInterface* visitor_; | 116 QuicConnectionVisitorInterface* visitor_; |
| 120 }; | 117 }; |
| 121 | 118 |
| 122 TEST_F(QuicServerSessionTest, CloseStreamDueToReset) { | 119 TEST_F(QuicServerSessionTest, CloseStreamDueToReset) { |
| 123 // Open a stream, then reset it. | 120 // Open a stream, then reset it. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // Incoming streams on the server session must be odd. | 228 // Incoming streams on the server session must be odd. |
| 232 EXPECT_EQ(NULL, | 229 EXPECT_EQ(NULL, |
| 233 QuicServerSessionPeer::GetIncomingReliableStream( | 230 QuicServerSessionPeer::GetIncomingReliableStream( |
| 234 session_.get(), 2)); | 231 session_.get(), 2)); |
| 235 } | 232 } |
| 236 | 233 |
| 237 } // namespace | 234 } // namespace |
| 238 } // namespace test | 235 } // namespace test |
| 239 } // namespace tools | 236 } // namespace tools |
| 240 } // namespace net | 237 } // namespace net |
| OLD | NEW |