| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| 11 #include "net/quic/crypto/crypto_handshake.h" | 11 #include "net/quic/crypto/crypto_handshake.h" |
| 12 #include "net/quic/crypto/quic_crypto_server_config.h" | 12 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 13 #include "net/quic/crypto/quic_random.h" | 13 #include "net/quic/crypto/quic_random.h" |
| 14 #include "net/quic/quic_connection_helper.h" | 14 #include "net/quic/quic_connection_helper.h" |
| 15 #include "net/quic/quic_crypto_stream.h" | 15 #include "net/quic/quic_crypto_stream.h" |
| 16 #include "net/quic/quic_flags.h" | 16 #include "net/quic/quic_flags.h" |
| 17 #include "net/quic/quic_utils.h" | 17 #include "net/quic/quic_utils.h" |
| 18 #include "net/quic/test_tools/crypto_test_utils.h" |
| 18 #include "net/quic/test_tools/quic_test_utils.h" | 19 #include "net/quic/test_tools/quic_test_utils.h" |
| 19 #include "net/tools/epoll_server/epoll_server.h" | 20 #include "net/tools/epoll_server/epoll_server.h" |
| 20 #include "net/tools/quic/quic_epoll_connection_helper.h" | 21 #include "net/tools/quic/quic_epoll_connection_helper.h" |
| 21 #include "net/tools/quic/quic_packet_writer_wrapper.h" | 22 #include "net/tools/quic/quic_packet_writer_wrapper.h" |
| 22 #include "net/tools/quic/quic_time_wait_list_manager.h" | 23 #include "net/tools/quic/quic_time_wait_list_manager.h" |
| 23 #include "net/tools/quic/test_tools/mock_quic_time_wait_list_manager.h" | 24 #include "net/tools/quic/test_tools/mock_quic_time_wait_list_manager.h" |
| 24 #include "net/tools/quic/test_tools/quic_dispatcher_peer.h" | 25 #include "net/tools/quic/test_tools/quic_dispatcher_peer.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 base::StringPiece; | 29 using base::StringPiece; |
| 29 using net::EpollServer; | 30 using net::EpollServer; |
| 30 using net::test::ConstructEncryptedPacket; | 31 using net::test::ConstructEncryptedPacket; |
| 32 using net::test::CryptoTestUtils; |
| 31 using net::test::MockConnection; | 33 using net::test::MockConnection; |
| 32 using net::test::MockHelper; | 34 using net::test::MockHelper; |
| 33 using net::test::ValueRestore; | 35 using net::test::ValueRestore; |
| 34 using net::test::TestWriterFactory; | 36 using net::test::TestWriterFactory; |
| 35 using std::string; | 37 using std::string; |
| 36 using std::vector; | 38 using std::vector; |
| 37 using testing::DoAll; | 39 using testing::DoAll; |
| 38 using testing::InSequence; | 40 using testing::InSequence; |
| 39 using testing::Invoke; | 41 using testing::Invoke; |
| 40 using testing::WithoutArgs; | 42 using testing::WithoutArgs; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 ProcessUdpPacket(_, client_address, _)); | 130 ProcessUdpPacket(_, client_address, _)); |
| 129 | 131 |
| 130 return *session; | 132 return *session; |
| 131 } | 133 } |
| 132 | 134 |
| 133 class QuicDispatcherTest : public ::testing::Test { | 135 class QuicDispatcherTest : public ::testing::Test { |
| 134 public: | 136 public: |
| 135 QuicDispatcherTest() | 137 QuicDispatcherTest() |
| 136 : helper_(&eps_), | 138 : helper_(&eps_), |
| 137 crypto_config_(QuicCryptoServerConfig::TESTING, | 139 crypto_config_(QuicCryptoServerConfig::TESTING, |
| 138 QuicRandom::GetInstance()), | 140 QuicRandom::GetInstance(), |
| 141 CryptoTestUtils::ProofSourceForTesting()), |
| 139 dispatcher_(config_, &crypto_config_, &eps_), | 142 dispatcher_(config_, &crypto_config_, &eps_), |
| 140 time_wait_list_manager_(nullptr), | 143 time_wait_list_manager_(nullptr), |
| 141 session1_(nullptr), | 144 session1_(nullptr), |
| 142 session2_(nullptr) { | 145 session2_(nullptr) { |
| 143 dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1)); | 146 dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1)); |
| 144 } | 147 } |
| 145 | 148 |
| 146 ~QuicDispatcherTest() override {} | 149 ~QuicDispatcherTest() override {} |
| 147 | 150 |
| 148 MockConnection* connection1() { | 151 MockConnection* connection1() { |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 // And we'll resume where we left off when we get another call. | 753 // And we'll resume where we left off when we get another call. |
| 751 EXPECT_CALL(*connection2(), OnCanWrite()); | 754 EXPECT_CALL(*connection2(), OnCanWrite()); |
| 752 dispatcher_.OnCanWrite(); | 755 dispatcher_.OnCanWrite(); |
| 753 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 756 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
| 754 } | 757 } |
| 755 | 758 |
| 756 } // namespace | 759 } // namespace |
| 757 } // namespace test | 760 } // namespace test |
| 758 } // namespace tools | 761 } // namespace tools |
| 759 } // namespace net | 762 } // namespace net |
| OLD | NEW |