| 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_simple_server_session.h" | 5 #include "net/tools/quic/quic_simple_server_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "net/quic/core/crypto/quic_crypto_server_config.h" | 11 #include "net/quic/core/crypto/quic_crypto_server_config.h" |
| 12 #include "net/quic/core/crypto/quic_random.h" | 12 #include "net/quic/core/crypto/quic_random.h" |
| 13 #include "net/quic/core/proto/cached_network_parameters.pb.h" | 13 #include "net/quic/core/proto/cached_network_parameters.pb.h" |
| 14 #include "net/quic/core/quic_connection.h" | 14 #include "net/quic/core/quic_connection.h" |
| 15 #include "net/quic/core/quic_crypto_server_stream.h" | 15 #include "net/quic/core/quic_crypto_server_stream.h" |
| 16 #include "net/quic/core/quic_utils.h" | 16 #include "net/quic/core/quic_utils.h" |
| 17 #include "net/quic/platform/api/quic_flags.h" | 17 #include "net/quic/platform/api/quic_flags.h" |
| 18 #include "net/quic/platform/api/quic_socket_address.h" | 18 #include "net/quic/platform/api/quic_socket_address.h" |
| 19 #include "net/quic/platform/api/quic_string_piece.h" | 19 #include "net/quic/platform/api/quic_string_piece.h" |
| 20 #include "net/quic/platform/api/quic_test.h" |
| 20 #include "net/quic/platform/api/quic_text_utils.h" | 21 #include "net/quic/platform/api/quic_text_utils.h" |
| 21 #include "net/quic/test_tools/crypto_test_utils.h" | 22 #include "net/quic/test_tools/crypto_test_utils.h" |
| 22 #include "net/quic/test_tools/quic_config_peer.h" | 23 #include "net/quic/test_tools/quic_config_peer.h" |
| 23 #include "net/quic/test_tools/quic_connection_peer.h" | 24 #include "net/quic/test_tools/quic_connection_peer.h" |
| 24 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 25 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
| 25 #include "net/quic/test_tools/quic_session_peer.h" | 26 #include "net/quic/test_tools/quic_session_peer.h" |
| 26 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 27 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
| 27 #include "net/quic/test_tools/quic_spdy_stream_peer.h" | 28 #include "net/quic/test_tools/quic_spdy_stream_peer.h" |
| 28 #include "net/quic/test_tools/quic_stream_peer.h" | 29 #include "net/quic/test_tools/quic_stream_peer.h" |
| 29 #include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h" | 30 #include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h" |
| 30 #include "net/quic/test_tools/quic_test_utils.h" | 31 #include "net/quic/test_tools/quic_test_utils.h" |
| 31 #include "net/test/gtest_util.h" | 32 #include "net/test/gtest_util.h" |
| 32 #include "net/tools/quic/quic_simple_server_stream.h" | 33 #include "net/tools/quic/quic_simple_server_stream.h" |
| 33 #include "net/tools/quic/test_tools/mock_quic_session_visitor.h" | 34 #include "net/tools/quic/test_tools/mock_quic_session_visitor.h" |
| 34 #include "testing/gmock/include/gmock/gmock.h" | |
| 35 #include "testing/gtest/include/gtest/gtest.h" | |
| 36 | 35 |
| 37 using std::string; | 36 using std::string; |
| 38 using testing::_; | 37 using testing::_; |
| 39 using testing::AtLeast; | 38 using testing::AtLeast; |
| 40 using testing::InSequence; | 39 using testing::InSequence; |
| 41 using testing::Return; | 40 using testing::Return; |
| 42 using testing::StrictMock; | 41 using testing::StrictMock; |
| 43 | 42 |
| 44 namespace net { | 43 namespace net { |
| 45 namespace test { | 44 namespace test { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 MOCK_METHOD5( | 167 MOCK_METHOD5( |
| 169 WriteHeadersMock, | 168 WriteHeadersMock, |
| 170 size_t(QuicStreamId stream_id, | 169 size_t(QuicStreamId stream_id, |
| 171 const SpdyHeaderBlock& headers, | 170 const SpdyHeaderBlock& headers, |
| 172 bool fin, | 171 bool fin, |
| 173 SpdyPriority priority, | 172 SpdyPriority priority, |
| 174 const QuicReferenceCountedPointer<QuicAckListenerInterface>& | 173 const QuicReferenceCountedPointer<QuicAckListenerInterface>& |
| 175 ack_listener)); | 174 ack_listener)); |
| 176 }; | 175 }; |
| 177 | 176 |
| 178 class QuicSimpleServerSessionTest | 177 class QuicSimpleServerSessionTest : public QuicTestWithParam<QuicVersion> { |
| 179 : public ::testing::TestWithParam<QuicVersion> { | |
| 180 protected: | 178 protected: |
| 181 QuicSimpleServerSessionTest() | 179 QuicSimpleServerSessionTest() |
| 182 : crypto_config_(QuicCryptoServerConfig::TESTING, | 180 : crypto_config_(QuicCryptoServerConfig::TESTING, |
| 183 QuicRandom::GetInstance(), | 181 QuicRandom::GetInstance(), |
| 184 crypto_test_utils::ProofSourceForTesting()), | 182 crypto_test_utils::ProofSourceForTesting()), |
| 185 compressed_certs_cache_( | 183 compressed_certs_cache_( |
| 186 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { | 184 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { |
| 187 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); | 185 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); |
| 188 config_.SetMaxIncomingDynamicStreamsToSend(kMaxStreamsForTest); | 186 config_.SetMaxIncomingDynamicStreamsToSend(kMaxStreamsForTest); |
| 189 QuicConfigPeer::SetReceivedMaxIncomingDynamicStreams(&config_, | 187 QuicConfigPeer::SetReceivedMaxIncomingDynamicStreams(&config_, |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 618 |
| 621 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); | 619 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); |
| 622 EXPECT_CALL(owner_, OnRstStreamReceived(_)).Times(1); | 620 EXPECT_CALL(owner_, OnRstStreamReceived(_)).Times(1); |
| 623 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); | 621 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); |
| 624 visitor_->OnRstStream(rst); | 622 visitor_->OnRstStream(rst); |
| 625 } | 623 } |
| 626 | 624 |
| 627 } // namespace | 625 } // namespace |
| 628 } // namespace test | 626 } // namespace test |
| 629 } // namespace net | 627 } // namespace net |
| OLD | NEW |