| 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/proto/cached_network_parameters.pb.h" | 9 #include "net/quic/proto/cached_network_parameters.pb.h" |
| 10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
| 11 #include "net/quic/quic_crypto_server_stream.h" | 11 #include "net/quic/quic_crypto_server_stream.h" |
| 12 #include "net/quic/quic_flags.h" | 12 #include "net/quic/quic_flags.h" |
| 13 #include "net/quic/quic_utils.h" | 13 #include "net/quic/quic_utils.h" |
| 14 #include "net/quic/test_tools/crypto_test_utils.h" |
| 14 #include "net/quic/test_tools/quic_config_peer.h" | 15 #include "net/quic/test_tools/quic_config_peer.h" |
| 15 #include "net/quic/test_tools/quic_connection_peer.h" | 16 #include "net/quic/test_tools/quic_connection_peer.h" |
| 16 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 17 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
| 17 #include "net/quic/test_tools/quic_session_peer.h" | 18 #include "net/quic/test_tools/quic_session_peer.h" |
| 18 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 19 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
| 19 #include "net/quic/test_tools/quic_spdy_stream_peer.h" | 20 #include "net/quic/test_tools/quic_spdy_stream_peer.h" |
| 20 #include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h" | 21 #include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h" |
| 21 #include "net/quic/test_tools/quic_test_utils.h" | 22 #include "net/quic/test_tools/quic_test_utils.h" |
| 22 #include "net/test/gtest_util.h" | 23 #include "net/test/gtest_util.h" |
| 23 #include "net/tools/quic/quic_spdy_server_stream.h" | 24 #include "net/tools/quic/quic_spdy_server_stream.h" |
| 24 #include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h" | 25 #include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h" |
| 25 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 28 |
| 28 using __gnu_cxx::vector; | 29 using __gnu_cxx::vector; |
| 30 using net::test::CryptoTestUtils; |
| 29 using net::test::MockConnection; | 31 using net::test::MockConnection; |
| 30 using net::test::MockHelper; | 32 using net::test::MockHelper; |
| 31 using net::test::QuicConfigPeer; | 33 using net::test::QuicConfigPeer; |
| 32 using net::test::QuicConnectionPeer; | 34 using net::test::QuicConnectionPeer; |
| 33 using net::test::QuicSpdyStreamPeer; | 35 using net::test::QuicSpdyStreamPeer; |
| 34 using net::test::QuicSentPacketManagerPeer; | 36 using net::test::QuicSentPacketManagerPeer; |
| 35 using net::test::QuicSessionPeer; | 37 using net::test::QuicSessionPeer; |
| 36 using net::test::QuicSpdySessionPeer; | 38 using net::test::QuicSpdySessionPeer; |
| 37 using net::test::QuicSustainedBandwidthRecorderPeer; | 39 using net::test::QuicSustainedBandwidthRecorderPeer; |
| 38 using net::test::SupportedVersions; | 40 using net::test::SupportedVersions; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 namespace { | 71 namespace { |
| 70 | 72 |
| 71 const size_t kMaxStreamsForTest = 10; | 73 const size_t kMaxStreamsForTest = 10; |
| 72 | 74 |
| 73 class QuicServerSessionTest : public ::testing::TestWithParam<QuicVersion> { | 75 class QuicServerSessionTest : public ::testing::TestWithParam<QuicVersion> { |
| 74 protected: | 76 protected: |
| 75 QuicServerSessionTest() | 77 QuicServerSessionTest() |
| 76 : crypto_config_(QuicCryptoServerConfig::TESTING, | 78 : crypto_config_(QuicCryptoServerConfig::TESTING, |
| 77 QuicRandom::GetInstance()) { | 79 QuicRandom::GetInstance(), |
| 80 CryptoTestUtils::ProofSourceForTesting()) { |
| 78 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, | 81 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, |
| 79 kMaxStreamsForTest); | 82 kMaxStreamsForTest); |
| 80 config_.SetInitialStreamFlowControlWindowToSend( | 83 config_.SetInitialStreamFlowControlWindowToSend( |
| 81 kInitialStreamFlowControlWindowForTest); | 84 kInitialStreamFlowControlWindowForTest); |
| 82 config_.SetInitialSessionFlowControlWindowToSend( | 85 config_.SetInitialSessionFlowControlWindowToSend( |
| 83 kInitialSessionFlowControlWindowForTest); | 86 kInitialSessionFlowControlWindowForTest); |
| 84 | 87 |
| 85 connection_ = new StrictMock<MockConnection>( | 88 connection_ = new StrictMock<MockConnection>( |
| 86 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); | 89 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); |
| 87 session_.reset( | 90 session_.reset( |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 QuicServerSessionPeer::IsBandwidthResumptionEnabled(session_.get())); | 490 QuicServerSessionPeer::IsBandwidthResumptionEnabled(session_.get())); |
| 488 session_->OnConfigNegotiated(); | 491 session_->OnConfigNegotiated(); |
| 489 EXPECT_FALSE( | 492 EXPECT_FALSE( |
| 490 QuicServerSessionPeer::IsBandwidthResumptionEnabled(session_.get())); | 493 QuicServerSessionPeer::IsBandwidthResumptionEnabled(session_.get())); |
| 491 } | 494 } |
| 492 | 495 |
| 493 } // namespace | 496 } // namespace |
| 494 } // namespace test | 497 } // namespace test |
| 495 } // namespace tools | 498 } // namespace tools |
| 496 } // namespace net | 499 } // namespace net |
| OLD | NEW |