| 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.h" | 5 #include "net/tools/quic/quic_server.h" |
| 6 | 6 |
| 7 #include "net/quic/core/crypto/quic_random.h" | 7 #include "net/quic/core/crypto/quic_random.h" |
| 8 #include "net/quic/core/quic_utils.h" | 8 #include "net/quic/core/quic_utils.h" |
| 9 #include "net/quic/test_tools/crypto_test_utils.h" | 9 #include "net/quic/test_tools/crypto_test_utils.h" |
| 10 #include "net/quic/test_tools/mock_quic_dispatcher.h" | 10 #include "net/quic/test_tools/mock_quic_dispatcher.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 int port_; | 91 int port_; |
| 92 IPEndPoint server_address_; | 92 IPEndPoint server_address_; |
| 93 TestQuicServer server_; | 93 TestQuicServer server_; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 // Tests that if dispatcher has CHLOs waiting for connection creation, EPOLLIN | 96 // Tests that if dispatcher has CHLOs waiting for connection creation, EPOLLIN |
| 97 // event should try to create connections for them. And set epoll mask with | 97 // event should try to create connections for them. And set epoll mask with |
| 98 // EPOLLIN if there are still CHLOs remaining at the end of epoll event. | 98 // EPOLLIN if there are still CHLOs remaining at the end of epoll event. |
| 99 TEST_F(QuicServerEpollInTest, ProcessBufferedCHLOsOnEpollin) { | 99 TEST_F(QuicServerEpollInTest, ProcessBufferedCHLOsOnEpollin) { |
| 100 FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; | 100 FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; |
| 101 FLAGS_quic_buffer_packet_till_chlo = true; | |
| 102 // Given an EPOLLIN event, try to create session for buffered CHLOs. In first | 101 // Given an EPOLLIN event, try to create session for buffered CHLOs. In first |
| 103 // event, dispatcher can't create session for all of CHLOs. So listener should | 102 // event, dispatcher can't create session for all of CHLOs. So listener should |
| 104 // register another EPOLLIN event by itself. Even without new packet arrival, | 103 // register another EPOLLIN event by itself. Even without new packet arrival, |
| 105 // the rest CHLOs should be process in next epoll event. | 104 // the rest CHLOs should be process in next epoll event. |
| 106 StartListening(); | 105 StartListening(); |
| 107 bool more_chlos = true; | 106 bool more_chlos = true; |
| 108 MockQuicSimpleDispatcher* dispatcher_ = server_.mock_dispatcher(); | 107 MockQuicSimpleDispatcher* dispatcher_ = server_.mock_dispatcher(); |
| 109 DCHECK(dispatcher_ != nullptr); | 108 DCHECK(dispatcher_ != nullptr); |
| 110 EXPECT_CALL(*dispatcher_, OnCanWrite()).Times(testing::AnyNumber()); | 109 EXPECT_CALL(*dispatcher_, OnCanWrite()).Times(testing::AnyNumber()); |
| 111 EXPECT_CALL(*dispatcher_, ProcessBufferedChlos(_)).Times(2); | 110 EXPECT_CALL(*dispatcher_, ProcessBufferedChlos(_)).Times(2); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 arraysize(valid_packet), | 191 arraysize(valid_packet), |
| 193 QuicTime::Zero(), false); | 192 QuicTime::Zero(), false); |
| 194 | 193 |
| 195 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); | 194 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); |
| 196 DispatchPacket(encrypted_valid_packet); | 195 DispatchPacket(encrypted_valid_packet); |
| 197 } | 196 } |
| 198 | 197 |
| 199 } // namespace | 198 } // namespace |
| 200 } // namespace test | 199 } // namespace test |
| 201 } // namespace net | 200 } // namespace net |
| OLD | NEW |