| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE { | 54 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE { |
| 55 return 0; | 55 return 0; |
| 56 } | 56 } |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class TestQuicQuicServerSession : public QuicServerSession { | 59 class TestQuicQuicServerSession : public QuicServerSession { |
| 60 public: | 60 public: |
| 61 TestQuicQuicServerSession(const QuicConfig& config, | 61 TestQuicQuicServerSession(const QuicConfig& config, |
| 62 QuicConnection* connection, | 62 QuicConnection* connection, |
| 63 QuicSessionOwner* owner) | 63 QuicServerSessionVisitor* owner) |
| 64 : QuicServerSession(config, connection, owner), | 64 : QuicServerSession(config, connection, owner), |
| 65 close_stream_on_data_(false) { | 65 close_stream_on_data_(false) {} |
| 66 } | |
| 67 | 66 |
| 68 virtual QuicDataStream* CreateIncomingDataStream( | 67 virtual QuicDataStream* CreateIncomingDataStream( |
| 69 QuicStreamId id) OVERRIDE { | 68 QuicStreamId id) OVERRIDE { |
| 70 if (!ShouldCreateIncomingDataStream(id)) { | 69 if (!ShouldCreateIncomingDataStream(id)) { |
| 71 return NULL; | 70 return NULL; |
| 72 } | 71 } |
| 73 if (close_stream_on_data_) { | 72 if (close_stream_on_data_) { |
| 74 return new CloseOnDataStream(id, this); | 73 return new CloseOnDataStream(id, this); |
| 75 } else { | 74 } else { |
| 76 return new QuicSpdyServerStream(id, this); | 75 return new QuicSpdyServerStream(id, this); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 103 visitor_ = QuicConnectionPeer::GetVisitor(connection_); | 102 visitor_ = QuicConnectionPeer::GetVisitor(connection_); |
| 104 } | 103 } |
| 105 | 104 |
| 106 void MarkHeadersReadForStream(QuicStreamId id) { | 105 void MarkHeadersReadForStream(QuicStreamId id) { |
| 107 QuicDataStream* stream = QuicServerSessionPeer::GetDataStream( | 106 QuicDataStream* stream = QuicServerSessionPeer::GetDataStream( |
| 108 session_.get(), id); | 107 session_.get(), id); |
| 109 ASSERT_TRUE(stream != NULL); | 108 ASSERT_TRUE(stream != NULL); |
| 110 QuicDataStreamPeer::SetHeadersDecompressed(stream, true); | 109 QuicDataStreamPeer::SetHeadersDecompressed(stream, true); |
| 111 } | 110 } |
| 112 | 111 |
| 113 StrictMock<MockQuicSessionOwner> owner_; | 112 StrictMock<MockQuicServerSessionVisitor> owner_; |
| 114 StrictMock<MockConnection>* connection_; | 113 StrictMock<MockConnection>* connection_; |
| 115 QuicConfig config_; | 114 QuicConfig config_; |
| 116 QuicCryptoServerConfig crypto_config_; | 115 QuicCryptoServerConfig crypto_config_; |
| 117 scoped_ptr<TestQuicQuicServerSession> session_; | 116 scoped_ptr<TestQuicQuicServerSession> session_; |
| 118 QuicConnectionVisitorInterface* visitor_; | 117 QuicConnectionVisitorInterface* visitor_; |
| 119 }; | 118 }; |
| 120 | 119 |
| 121 INSTANTIATE_TEST_CASE_P(Tests, QuicServerSessionTest, | 120 INSTANTIATE_TEST_CASE_P(Tests, QuicServerSessionTest, |
| 122 ::testing::ValuesIn(QuicSupportedVersions())); | 121 ::testing::ValuesIn(QuicSupportedVersions())); |
| 123 | 122 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // Incoming streams on the server session must be odd. | 249 // Incoming streams on the server session must be odd. |
| 251 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID)); | 250 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID)); |
| 252 EXPECT_EQ(NULL, | 251 EXPECT_EQ(NULL, |
| 253 QuicServerSessionPeer::GetIncomingDataStream(session_.get(), 4)); | 252 QuicServerSessionPeer::GetIncomingDataStream(session_.get(), 4)); |
| 254 } | 253 } |
| 255 | 254 |
| 256 } // namespace | 255 } // namespace |
| 257 } // namespace test | 256 } // namespace test |
| 258 } // namespace tools | 257 } // namespace tools |
| 259 } // namespace net | 258 } // namespace net |
| OLD | NEW |