| 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::ValueRestore; | 34 using net::test::ValueRestore; |
| 33 using net::test::TestWriterFactory; | 35 using net::test::TestWriterFactory; |
| 34 using std::string; | 36 using std::string; |
| 35 using std::vector; | 37 using std::vector; |
| 36 using testing::DoAll; | 38 using testing::DoAll; |
| 37 using testing::InSequence; | 39 using testing::InSequence; |
| 38 using testing::Invoke; | 40 using testing::Invoke; |
| 39 using testing::WithoutArgs; | 41 using testing::WithoutArgs; |
| 40 using testing::_; | 42 using testing::_; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ProcessUdpPacket(_, client_address, _)); | 127 ProcessUdpPacket(_, client_address, _)); |
| 126 | 128 |
| 127 return *session; | 129 return *session; |
| 128 } | 130 } |
| 129 | 131 |
| 130 class QuicDispatcherTest : public ::testing::Test { | 132 class QuicDispatcherTest : public ::testing::Test { |
| 131 public: | 133 public: |
| 132 QuicDispatcherTest() | 134 QuicDispatcherTest() |
| 133 : helper_(&eps_), | 135 : helper_(&eps_), |
| 134 crypto_config_(QuicCryptoServerConfig::TESTING, | 136 crypto_config_(QuicCryptoServerConfig::TESTING, |
| 135 QuicRandom::GetInstance()), | 137 QuicRandom::GetInstance(), |
| 138 CryptoTestUtils::ProofSourceForTesting()), |
| 136 dispatcher_(config_, &crypto_config_, &eps_), | 139 dispatcher_(config_, &crypto_config_, &eps_), |
| 137 time_wait_list_manager_(nullptr), | 140 time_wait_list_manager_(nullptr), |
| 138 session1_(nullptr), | 141 session1_(nullptr), |
| 139 session2_(nullptr) { | 142 session2_(nullptr) { |
| 140 dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1)); | 143 dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1)); |
| 141 } | 144 } |
| 142 | 145 |
| 143 ~QuicDispatcherTest() override {} | 146 ~QuicDispatcherTest() override {} |
| 144 | 147 |
| 145 MockConnection* connection1() { | 148 MockConnection* connection1() { |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 // And we'll resume where we left off when we get another call. | 748 // And we'll resume where we left off when we get another call. |
| 746 EXPECT_CALL(*connection2(), OnCanWrite()); | 749 EXPECT_CALL(*connection2(), OnCanWrite()); |
| 747 dispatcher_.OnCanWrite(); | 750 dispatcher_.OnCanWrite(); |
| 748 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 751 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
| 749 } | 752 } |
| 750 | 753 |
| 751 } // namespace | 754 } // namespace |
| 752 } // namespace test | 755 } // namespace test |
| 753 } // namespace tools | 756 } // namespace tools |
| 754 } // namespace net | 757 } // namespace net |
| OLD | NEW |