| 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_base.h" | 5 #include "net/tools/quic/quic_server_session_base.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "net/quic/test_tools/quic_spdy_stream_peer.h" | 23 #include "net/quic/test_tools/quic_spdy_stream_peer.h" |
| 24 #include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h" | 24 #include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h" |
| 25 #include "net/quic/test_tools/quic_test_utils.h" | 25 #include "net/quic/test_tools/quic_test_utils.h" |
| 26 #include "net/test/gtest_util.h" | 26 #include "net/test/gtest_util.h" |
| 27 #include "net/tools/quic/quic_simple_server_stream.h" | 27 #include "net/tools/quic/quic_simple_server_stream.h" |
| 28 #include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h" | 28 #include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h" |
| 29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 31 | 31 |
| 32 using net::test::CryptoTestUtils; | 32 using net::test::CryptoTestUtils; |
| 33 using net::test::MockConnection; | 33 using net::test::MockQuicConnection; |
| 34 using net::test::MockConnectionHelper; | 34 using net::test::MockQuicConnectionHelper; |
| 35 using net::test::QuicConfigPeer; | 35 using net::test::QuicConfigPeer; |
| 36 using net::test::QuicConnectionPeer; | 36 using net::test::QuicConnectionPeer; |
| 37 using net::test::QuicSpdyStreamPeer; | 37 using net::test::QuicSpdyStreamPeer; |
| 38 using net::test::QuicSentPacketManagerPeer; | 38 using net::test::QuicSentPacketManagerPeer; |
| 39 using net::test::QuicSessionPeer; | 39 using net::test::QuicSessionPeer; |
| 40 using net::test::QuicSpdySessionPeer; | 40 using net::test::QuicSpdySessionPeer; |
| 41 using net::test::QuicSustainedBandwidthRecorderPeer; | 41 using net::test::QuicSustainedBandwidthRecorderPeer; |
| 42 using net::test::SupportedVersions; | 42 using net::test::SupportedVersions; |
| 43 using net::test::ValueRestore; | 43 using net::test::ValueRestore; |
| 44 using net::test::kClientDataStreamId1; | 44 using net::test::kClientDataStreamId1; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 CryptoTestUtils::ProofSourceForTesting()), | 127 CryptoTestUtils::ProofSourceForTesting()), |
| 128 compressed_certs_cache_( | 128 compressed_certs_cache_( |
| 129 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { | 129 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { |
| 130 FLAGS_quic_always_log_bugs_for_tests = true; | 130 FLAGS_quic_always_log_bugs_for_tests = true; |
| 131 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); | 131 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); |
| 132 config_.SetInitialStreamFlowControlWindowToSend( | 132 config_.SetInitialStreamFlowControlWindowToSend( |
| 133 kInitialStreamFlowControlWindowForTest); | 133 kInitialStreamFlowControlWindowForTest); |
| 134 config_.SetInitialSessionFlowControlWindowToSend( | 134 config_.SetInitialSessionFlowControlWindowToSend( |
| 135 kInitialSessionFlowControlWindowForTest); | 135 kInitialSessionFlowControlWindowForTest); |
| 136 | 136 |
| 137 connection_ = new StrictMock<MockConnection>(&helper_, &alarm_factory_, | 137 connection_ = new StrictMock<MockQuicConnection>( |
| 138 Perspective::IS_SERVER, | 138 &helper_, &alarm_factory_, Perspective::IS_SERVER, |
| 139 SupportedVersions(GetParam())); | 139 SupportedVersions(GetParam())); |
| 140 session_.reset(new TestServerSession(config_, connection_, &owner_, | 140 session_.reset(new TestServerSession(config_, connection_, &owner_, |
| 141 &crypto_config_, | 141 &crypto_config_, |
| 142 &compressed_certs_cache_)); | 142 &compressed_certs_cache_)); |
| 143 MockClock clock; | 143 MockClock clock; |
| 144 handshake_message_.reset(crypto_config_.AddDefaultConfig( | 144 handshake_message_.reset(crypto_config_.AddDefaultConfig( |
| 145 QuicRandom::GetInstance(), &clock, | 145 QuicRandom::GetInstance(), &clock, |
| 146 QuicCryptoServerConfig::ConfigOptions())); | 146 QuicCryptoServerConfig::ConfigOptions())); |
| 147 session_->Initialize(); | 147 session_->Initialize(); |
| 148 visitor_ = QuicConnectionPeer::GetVisitor(connection_); | 148 visitor_ = QuicConnectionPeer::GetVisitor(connection_); |
| 149 } | 149 } |
| 150 | 150 |
| 151 StrictMock<MockQuicServerSessionVisitor> owner_; | 151 StrictMock<MockQuicServerSessionVisitor> owner_; |
| 152 MockConnectionHelper helper_; | 152 MockQuicConnectionHelper helper_; |
| 153 MockAlarmFactory alarm_factory_; | 153 MockAlarmFactory alarm_factory_; |
| 154 StrictMock<MockConnection>* connection_; | 154 StrictMock<MockQuicConnection>* connection_; |
| 155 QuicConfig config_; | 155 QuicConfig config_; |
| 156 QuicCryptoServerConfig crypto_config_; | 156 QuicCryptoServerConfig crypto_config_; |
| 157 QuicCompressedCertsCache compressed_certs_cache_; | 157 QuicCompressedCertsCache compressed_certs_cache_; |
| 158 std::unique_ptr<TestServerSession> session_; | 158 std::unique_ptr<TestServerSession> session_; |
| 159 std::unique_ptr<CryptoHandshakeMessage> handshake_message_; | 159 std::unique_ptr<CryptoHandshakeMessage> handshake_message_; |
| 160 QuicConnectionVisitorInterface* visitor_; | 160 QuicConnectionVisitorInterface* visitor_; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 // Compares CachedNetworkParameters. | 163 // Compares CachedNetworkParameters. |
| 164 MATCHER_P(EqualsProto, network_params, "") { | 164 MATCHER_P(EqualsProto, network_params, "") { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 EXPECT_FALSE( | 549 EXPECT_FALSE( |
| 550 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 550 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 551 session_->OnConfigNegotiated(); | 551 session_->OnConfigNegotiated(); |
| 552 EXPECT_FALSE( | 552 EXPECT_FALSE( |
| 553 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); | 553 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); |
| 554 } | 554 } |
| 555 | 555 |
| 556 } // namespace | 556 } // namespace |
| 557 } // namespace test | 557 } // namespace test |
| 558 } // namespace net | 558 } // namespace net |
| OLD | NEW |