| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 : QuicDispatcher(config, | 48 : QuicDispatcher(config, |
| 49 crypto_config, | 49 crypto_config, |
| 50 QuicSupportedVersions(), | 50 QuicSupportedVersions(), |
| 51 eps) { | 51 eps) { |
| 52 } | 52 } |
| 53 | 53 |
| 54 MOCK_METHOD3(CreateQuicSession, QuicSession*( | 54 MOCK_METHOD3(CreateQuicSession, QuicSession*( |
| 55 QuicConnectionId connection_id, | 55 QuicConnectionId connection_id, |
| 56 const IPEndPoint& server_address, | 56 const IPEndPoint& server_address, |
| 57 const IPEndPoint& client_address)); | 57 const IPEndPoint& client_address)); |
| 58 using QuicDispatcher::write_blocked_list; | |
| 59 | 58 |
| 60 using QuicDispatcher::current_server_address; | 59 using QuicDispatcher::current_server_address; |
| 61 using QuicDispatcher::current_client_address; | 60 using QuicDispatcher::current_client_address; |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 // A Connection class which unregisters the session from the dispatcher | 63 // A Connection class which unregisters the session from the dispatcher |
| 65 // when sending connection close. | 64 // when sending connection close. |
| 66 // It'd be slightly more realistic to do this from the Session but it would | 65 // It'd be slightly more realistic to do this from the Session but it would |
| 67 // involve a lot more mocking. | 66 // involve a lot more mocking. |
| 68 class MockServerConnection : public MockConnection { | 67 class MockServerConnection : public MockConnection { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 EXPECT_CALL(dispatcher_, CreateQuicSession(_, _, client_address)) | 293 EXPECT_CALL(dispatcher_, CreateQuicSession(_, _, client_address)) |
| 295 .WillOnce(testing::Return(CreateSession( | 294 .WillOnce(testing::Return(CreateSession( |
| 296 &dispatcher_, 1, client_address, &session1_))); | 295 &dispatcher_, 1, client_address, &session1_))); |
| 297 ProcessPacket(client_address, 1, true, "foo"); | 296 ProcessPacket(client_address, 1, true, "foo"); |
| 298 | 297 |
| 299 EXPECT_CALL(dispatcher_, CreateQuicSession(_, _, client_address)) | 298 EXPECT_CALL(dispatcher_, CreateQuicSession(_, _, client_address)) |
| 300 .WillOnce(testing::Return(CreateSession( | 299 .WillOnce(testing::Return(CreateSession( |
| 301 &dispatcher_, 2, client_address, &session2_))); | 300 &dispatcher_, 2, client_address, &session2_))); |
| 302 ProcessPacket(client_address, 2, true, "bar"); | 301 ProcessPacket(client_address, 2, true, "bar"); |
| 303 | 302 |
| 304 blocked_list_ = dispatcher_.write_blocked_list(); | 303 blocked_list_ = QuicDispatcherPeer::GetWriteBlockedList(&dispatcher_); |
| 305 } | 304 } |
| 306 | 305 |
| 307 virtual void TearDown() { | 306 virtual void TearDown() { |
| 308 EXPECT_CALL(*connection1(), SendConnectionClose(QUIC_PEER_GOING_AWAY)); | 307 EXPECT_CALL(*connection1(), SendConnectionClose(QUIC_PEER_GOING_AWAY)); |
| 309 EXPECT_CALL(*connection2(), SendConnectionClose(QUIC_PEER_GOING_AWAY)); | 308 EXPECT_CALL(*connection2(), SendConnectionClose(QUIC_PEER_GOING_AWAY)); |
| 310 dispatcher_.Shutdown(); | 309 dispatcher_.Shutdown(); |
| 311 } | 310 } |
| 312 | 311 |
| 313 void SetBlocked() { | 312 void SetBlocked() { |
| 314 writer_->write_blocked_ = true; | 313 writer_->write_blocked_ = true; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 // And we'll resume where we left off when we get another call. | 450 // And we'll resume where we left off when we get another call. |
| 452 EXPECT_CALL(*connection2(), OnCanWrite()); | 451 EXPECT_CALL(*connection2(), OnCanWrite()); |
| 453 dispatcher_.OnCanWrite(); | 452 dispatcher_.OnCanWrite(); |
| 454 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 453 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
| 455 } | 454 } |
| 456 | 455 |
| 457 } // namespace | 456 } // namespace |
| 458 } // namespace test | 457 } // namespace test |
| 459 } // namespace tools | 458 } // namespace tools |
| 460 } // namespace net | 459 } // namespace net |
| OLD | NEW |