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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 namespace net { | 34 namespace net { |
35 namespace tools { | 35 namespace tools { |
36 namespace test { | 36 namespace test { |
37 namespace { | 37 namespace { |
38 | 38 |
39 class TestDispatcher : public QuicDispatcher { | 39 class TestDispatcher : public QuicDispatcher { |
40 public: | 40 public: |
41 explicit TestDispatcher(const QuicConfig& config, | 41 explicit TestDispatcher(const QuicConfig& config, |
42 const QuicCryptoServerConfig& crypto_config, | 42 const QuicCryptoServerConfig& crypto_config, |
43 EpollServer* eps) | 43 EpollServer* eps) |
44 : QuicDispatcher(config, crypto_config, 1, eps) {} | 44 : QuicDispatcher(config, crypto_config, QuicSupportedVersions(), 1, eps) { |
| 45 } |
45 | 46 |
46 MOCK_METHOD2(CreateQuicSession, QuicSession*( | 47 MOCK_METHOD2(CreateQuicSession, QuicSession*( |
47 QuicGuid guid, | 48 QuicGuid guid, |
48 const IPEndPoint& client_address)); | 49 const IPEndPoint& client_address)); |
49 using QuicDispatcher::write_blocked_list; | 50 using QuicDispatcher::write_blocked_list; |
50 }; | 51 }; |
51 | 52 |
52 // A Connection class which unregisters the session from the dispatcher | 53 // A Connection class which unregisters the session from the dispatcher |
53 // when sending connection close. | 54 // when sending connection close. |
54 // It'd be slightly more realistic to do this from the Session but it would | 55 // It'd be slightly more realistic to do this from the Session but it would |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()), | 168 EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()), |
168 SendConnectionClose(QUIC_PEER_GOING_AWAY)); | 169 SendConnectionClose(QUIC_PEER_GOING_AWAY)); |
169 | 170 |
170 dispatcher_.Shutdown(); | 171 dispatcher_.Shutdown(); |
171 } | 172 } |
172 | 173 |
173 class MockTimeWaitListManager : public QuicTimeWaitListManager { | 174 class MockTimeWaitListManager : public QuicTimeWaitListManager { |
174 public: | 175 public: |
175 MockTimeWaitListManager(QuicPacketWriter* writer, | 176 MockTimeWaitListManager(QuicPacketWriter* writer, |
176 EpollServer* eps) | 177 EpollServer* eps) |
177 : QuicTimeWaitListManager(writer, eps) { | 178 : QuicTimeWaitListManager(writer, eps, QuicSupportedVersions()) { |
178 } | 179 } |
179 | 180 |
180 MOCK_METHOD4(ProcessPacket, void(const IPEndPoint& server_address, | 181 MOCK_METHOD4(ProcessPacket, void(const IPEndPoint& server_address, |
181 const IPEndPoint& client_address, | 182 const IPEndPoint& client_address, |
182 QuicGuid guid, | 183 QuicGuid guid, |
183 const QuicEncryptedPacket& packet)); | 184 const QuicEncryptedPacket& packet)); |
184 }; | 185 }; |
185 | 186 |
186 TEST_F(QuicDispatcherTest, TimeWaitListManager) { | 187 TEST_F(QuicDispatcherTest, TimeWaitListManager) { |
187 MockTimeWaitListManager* time_wait_list_manager = | 188 MockTimeWaitListManager* time_wait_list_manager = |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // And we'll resume where we left off when we get another call. | 370 // And we'll resume where we left off when we get another call. |
370 EXPECT_CALL(*connection2(), OnCanWrite()); | 371 EXPECT_CALL(*connection2(), OnCanWrite()); |
371 dispatcher_.OnCanWrite(); | 372 dispatcher_.OnCanWrite(); |
372 } | 373 } |
373 | 374 |
374 | 375 |
375 } // namespace | 376 } // namespace |
376 } // namespace test | 377 } // namespace test |
377 } // namespace tools | 378 } // namespace tools |
378 } // namespace net | 379 } // namespace net |
OLD | NEW |